【发布时间】:2022-08-21 08:11:51
【问题描述】:
我对切片操作有几个问题。 在 pandas 中,我们可以进行如下操作:
df[\"A\"].iloc[0]
df[\"B\"].iloc[-1]
# here df[\"A\"],df[\"B\"] is sorted
因为我们不能用 Dask 做这个(切片和 Multiple_col_sorting)(我不是 100% 确定),所以我用另一种方法来做
df[\"A\"]=df.sort_values(by=[\'A\'])
first=list(df[\"A\"])[0]
df[\"B\"]=df.sort_values(by=[\'B\'])
end=list(df[\"B\"])[-1]
当数据帧很大时,这种方式真的很耗时,有没有其他方法可以做这个操作?
https://docs.dask.org/en/latest/dataframe-indexing.html
https://docs.dask.org/en/latest/array-slicing.html
我尝试使用它,但它不起作用。
标签: python pandas dataframe dask