在python中的pandas.read_csv中的行之间添加了新行

时间:2019-03-03 13:45:29

标签: python-3.x pandas csv

我在Windows上运行此命令,在熊猫中打开的每个csv文件在某些​​行之后都包含相同的新行。 我的代码:

import pandas as pd
csv_path=('csv.csv')
df=pd.read_csv(csv_path,encoding='cp1252')
print(df)

输出:

    1   Eldon Base for stackable storage shelf, platinum Muhammed MacIntyre  \
0   2  1.7 Cubic Foot Compact "Cube" Office Refrigera...       Barry French   
1   3   Cardinal Slant-D® Ring Binder, Heavy Gauge Vinyl       Barry French   
2   4                                               R380      Clay Rozendal   
3   5                           Holmes HEPA Air Purifier     Carlos Soltero   
4   6  G.E. Longer-Life Indoor Recessed Floodlight Bulbs     Carlos Soltero   
5   7  Angle-D Binders with Locking Rings, Label Holders       Carl Jackson   
6   8            SAFCO Mobile Desk Side File, Wire Frame       Carl Jackson   
7   9              SAFCO Commercial Wire Shelving, Black     Monica Federle   
8  10                                          Xerox 198    Dorothy Badders   

     3  -213.25   38.94     35  Nunavut          Storage & Organization   0.8  
0  293   457.81  208.16  68.02  Nunavut                      Appliances  0.58  
1  293    46.71    8.69   2.99  Nunavut  Binders and Binder Accessories  0.39  
2  483  1198.97  195.99   3.99  Nunavut    Telephones and Communication  0.58  
3  515    30.94   21.78   5.94  Nunavut                      Appliances  0.50  
4  515     4.43    6.64   4.95  Nunavut              Office Furnishings  0.37  
5  613   -54.04    7.30   7.72  Nunavut  Binders and Binder Accessories  0.38  
6  613   127.70   42.76   6.22  Nunavut          Storage & Organization   NaN  
7  643  -695.26  138.14  35.00  Nunavut          Storage & Organization   NaN  
8  678  -226.36    4.98   8.33  Nunavut                           Paper  0.38  

我的输出由\分隔到新行中。 我想要全部放在一行中。

0 个答案:

没有答案