【发布时间】:2020-10-11 06:18:59
【问题描述】:
我正在使用 Dask 计算从 here 下载的数据的平均值。当我开始动手操作时,在 Dask 上,我将 csv 文件转换为 hdf5。
我使用的配置是:Dask 2.19 版本、Python 3.8、Pandas 1.0.5 和 h5py 2.10.0。
import dask.dataframe as dd
df_csv = dd.read_csv("2018_Yellow_Taxi_Trip_Data.csv", dtype={'DOLocationID': 'float64',
'PULocationID': 'float64',
'RatecodeID': 'float64',
'passenger_count': 'float64',
'payment_type': 'float64'})
# converting it to hdf5 format
df_csv.to_hdf(path_or_buf="2018_Yellow_Taxi_Trip_Data.h5", key="taxi_data",
format="table")
使用 dask 读取 hdf5
filename = "2018_Yellow_Taxi_Trip_Data.h5"
temp_trip_data = dd.read_hdf(pattern=filename, key="taxi_data")
#getting passenger count from temp_trip_data
time_series = temp_trip_data["passenger_count"]
使用默认属性计算平均值
print(time_series.mean().compute())
1.5731398237126735
更改配置以在多个进程上运行它
da.config.set(scheduler='processes')
在为进程设置时间表后变得平均
print(time_series.mean().compute())
给我一个错误:HDF5ExtError
有关错误的更多详细信息HDF5ExtError: HDF5 error back trace
File "H5F.c", line 509, in H5Fopen
unable to open file
File "H5Fint.c", line 1400, in H5F__open
unable to open file
File "H5Fint.c", line 1615, in H5F_open
unable to lock the file
File "H5FD.c", line 1640, in H5FD_lock
driver lock request failed
File "H5FDsec2.c", line 941, in H5FD_sec2_lock
unable to lock file, errno = 11, error message = 'Resource temporarily unavailable'
End of HDF5 error back trace
Unable to open/create file '2018_Yellow_Taxi_Trip_Data.h5'
这似乎是一种非常奇怪的行为。知道为什么会这样吗? Dask 有什么问题?
【问题讨论】: