NotImplementedError: pandas read_csv还不支持文件结构 [英] NotImplementedError: file structure not yet supported from pandas read_csv
问题描述
在此
关于可能出什么问题的任何想法?在此相同数据集的较小样本上的相关查询在这里:读取时Python熊猫中的日期解析错误文件 Any idea on what might be going wrong? Related query on a smaller sample of this same dataset is here:
Date parse error in Python pandas while reading file 感谢@cosmoscalibur发现文件缺少列,一种解决方案是跳过对标头的解析: Thanks to @cosmoscalibur for spotting that your file is missing columns, one solution is to skip parsing the header: 这将要求您在加载后将单列从"3"重命名为"PRCP": this will require you to rename the single column from '3' to 'PRCP' after loading: 这篇关于NotImplementedError: pandas read_csv还不支持文件结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!推荐答案
df = pandas.read_csv('300113R1.DNC', skiprows = 12, delim_whitespace=True,usecols=[0,1,2,3], header=None
parse_dates={"datetime": [0,1,2]}, index_col="datetime",
date_parser=lambda x: pandas.datetime.strptime(x, '%Y %m %d'))
df = df.rename(columns={3:'PRCP'})