问题:
I'm trying to get the number of rows of dataframe df with Pandas, and here is my code. 我正在尝试使用Pandas获取数据框df的行数,这是我的代码。
Method 1: 方法1:
total_rows = df.count
print total_rows +1
Method 2: 方法2:
total_rows = df['First_columnn_label'].count
print total_rows +1
Both the code snippets give me this error: 这两个代码段都给我这个错误:
TypeError: unsupported operand type(s) for +: 'instancemethod' and 'int' TypeError:+不支持的操作数类型:“ instancemethod”和“ int”
What am I doing wrong? 我究竟做错了什么?
解决方案:
参考一: https://stackoom.com/question/14thZ/如何获取大熊猫DataFrame的行数参考二: https://oldbug.net/q/14thZ/How-do-I-get-the-row-count-of-a-pandas-DataFrame
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4328542