我应该如何获得简洁的数据框的形状? [英] How should I get the shape of a dask dataframe?
本文介绍了我应该如何获得简洁的数据框的形状?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
执行.shape给我以下错误。
Performing .shape is giving me the following error.
AttributeError: DataFrame对象没有属性 shape
AttributeError: 'DataFrame' object has no attribute 'shape'
应该如何获取形状?
推荐答案
您可以直接获取列数
len(df.columns) # this is fast
您也可以在数据帧本身上调用len,尽管要注意这会触发计算。
You can also call len on the dataframe itself, though beware that this will trigger a computation.
len(df) # this requires a full scan of the data
Dask.dataframe进行全面扫描在不先阅读所有数据的情况下,不知道数据中有多少条记录。
Dask.dataframe doesn't know how many records are in your data without first reading through all of it.
这篇关于我应该如何获得简洁的数据框的形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文