python - 我应该如何获得 dask 数据框的形状?
问题描述
执行 .shape 给了我以下错误。
AttributeError:“DataFrame”对象没有属性“shape”
我应该如何获得形状?
解决方案
可以直接获取列数
len(df.columns) # this is fast
您也可以在数据帧本身上调用 len,但请注意这会触发计算。
len(df) # this requires a full scan of the data
Dask.dataframe 不知道您的数据中有多少条记录,而无需先阅读所有记录。
推荐阅读
- django - check_password() 返回 False
- postgresql - PostgreSQL - 存储多个主题的实时数据
- angular - 使用 angular 6 和 laravel 5.6 删除数据
- ios - 使用 '!' 这里已弃用,将在未来的版本中删除 - swift 4.2
- java - 找不到参数的方法 create()
- android - 如何删除键盘上方的多余空间?
- javascript - 为数据表中的各个行添加点击事件(JQuery)
- angular - ngb-accordion 标题内的按钮默认打开面板以及自定义功能
- c++ - OpenCV 3.4.3 中对“cv::String::deallocate()”错误的未定义引用
- adobe - 工作流超时功能在 aem 中不起作用