如何获取大熊猫DataFrame的行数?

依然范特西╮ 提交于 2020-08-13 03:00:57

问题:

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!