我有以下file.txt的(有删节):熊猫:read_csv表示“空格分隔”
SICcode Catcode Category SICname MultSIC
0111 A1500 Wheat, corn, soybeans and cash grain Wheat X
0112 A1600 Other commodities (incl rice, peanuts) Rice X
0115 A1500 Wheat, corn, soybeans and cash grain Corn X
0116 A1500 Wheat, corn, soybeans and cash grain Soybeans X
0119 A1500 Wheat, corn, soybeans and cash grain Cash grains, NEC X
0131 A1100 Cotton Cotton X
0132 A1300 Tobacco & Tobacco products Tobacco X
我有一些问题,将其读入一个大熊猫DF。我试图pd.read_csv
以下规格engine='python', sep='Tab'
但它在一列返回的文件:
SICcode Catcode Category SICname MultSIC
0 0111 A1500 Wheat, corn, soybeans...
1 0112 A1600 Other commodities (in...
2 0115 A1500 Wheat, corn, soybeans...
3 0116 A1500 Wheat, corn, soybeans...
然后我试图把它放到使用“标签”作为分隔符的Gnumeric文件,但它读取该文件为一列。有没有人有这个想法?
@ unutbu:它的工作!谢谢! –