所以我刚刚开始研究熊猫的世界,我发现的第一个奇怪的csv文件是一个在开头有两行注释(具有不同的列宽)的文件。在
sometext, sometext2
moretext, moretext1, moretext2
*header*
actual data ---
---------------
我知道如何用skiprows
或header=
跳过这些行,但是,在使用read_csv
时,如何保留这些注释呢?有时注释作为文件元数据是必需的,我不想把它们丢掉。在
有什么想法吗,伙计们?我会非常感谢你的回答。在
Tags:
您可以先读取元数据,然后使用
read_csv
:Pandas是用来读取结构化数据的。在
对于非结构化数据,只需使用内置的^{} :
可以将字符串附加到数据帧,如下所示:
^{pr2}$But note:
相关问题 更多 >
编程相关推荐