import dask.dataframe as dd
import pandas as pd
path2file = "yourpath.csv"
cols = ["User", "ProductA"]
# Be careful about the sep (check if it is ; or something else and add it to the
# function below as parameter if so
dataset = dd.read_csv(path2file, usecols=cols)
# Filter
dataset = dataset.loc[dataset["User"]=="C"]), :]
dataset = dataset.compute()
您可以使用
dask.dataframe
的read_csv
函数,过滤并将df
转换为数据帧:相关问题 更多 >
编程相关推荐