How should I get the shape of a dask dataframe?

后端 未结 5 1536
醉话见心
醉话见心 2021-01-03 22:12

Performing .shape is giving me the following error.

AttributeError: \'DataFrame\' object has no attribute \'shape\'

How should

5条回答
  •  一向
    一向 (楼主)
    2021-01-03 22:36

    You can get the number of columns directly

    len(df.columns)  # this is fast
    

    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 doesn't know how many records are in your data without first reading through all of it.

提交回复
热议问题