Python 如何在熊猫中读取带有分号分隔符的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24606330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 04:51:15 来源:igfitidea点击:
How to read a file with a semi colon separator in pandas
提问by Jean
I a importing a .csv
file in python with pandas.
我.csv
用pandas在python中导入一个文件。
Here is the file format from the .csv
:
这是来自以下文件的文件格式.csv
:
a1;b1;c1;d1;e1;...
a2;b2;c2;d2;e2;...
.....
here is how get it :
这里是如何得到它:
from pandas import *
csv_path = "C:...."
data = read_csv(csv_path)
Now when I print the file I get that :
现在,当我打印文件时,我得到了:
0 a1;b1;c1;d1;e1;...
1 a2;b2;c2;d2;e2;...
And so on... So I need help to read the file and split the values in columns, with the semi color character ;
.
等等......所以我需要帮助来读取文件并使用半色字符将值拆分为列;
。