I run the following script in Python:
t2 = t1.select("count(*)")
t2.toDF()
Output (of DataFrame type):
count
0 13136
If I run the script as follows:
t2.toDF().count # count is the column name corresponding to the result of count(*)
Output (of <class 'method'> data type):
<bound method DataFrame.count of count
0 13136>
How to get the number of records of type scalar?
Solution 1: use function pandas.DataFrame.count.
Solution 2:
In DolphinDB, the output of
t2=t1.select("count(*)")is stored in the “count“ column.t2.toDF().countdoes not return the result of the count column as there is a method count with the same name in pandas.DataFrame. It is recommended to specify aliases for the result columns returned by count(*).Return a Seires. You can obtain the scalar with index.
See also: DolphinDB Python API