【发布时间】:2020-07-28 03:46:36
【问题描述】:
我有一个非常相似的问题:Dask read_csv-- Mismatched dtypes found in `pd.read_csv`/`pd.read_table`
我正在运行以下脚本:
import pandas as pd
import dask.dataframe as dd
df2 = dd.read_csv("Path/*.csv", sep='\t', encoding='unicode_escape', sample=2500000)
df2 = df2.loc[~df2['Type'].isin(['STVKT','STKKT', 'STVK', 'STKK', 'STKET', 'STVET', 'STK', 'STKVT', 'STVVT', 'STV', 'STVZT', 'STVV', 'STKV', 'STVAT', 'STKAT', 'STKZT', 'STKAO', 'STKZE', 'STVAO', 'STVZE', 'STVT', 'STVNT'])]
df2 = df.compute()
我得到以下错误:ValueError: Mismatched dtypes found in pd.read_csv/pd.read_table。
我怎样才能避免这种情况?我有超过 32 列,所以我无法预先设置 dtypes。作为提示,还写了:Specify dtype option on import or set low_memory=False
【问题讨论】:
标签: python pandas dataframe dask