熊猫无法正确读取给定的CSV文件

时间:2020-03-29 08:01:37

标签: python pandas

我尝试下面的代码,但无法纠正数据框。请让我知道使用熊猫读取CSV文件的正确代码。

CSV文件:CSV File

我的代码:

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("Data 8199 2391 6_6_2019 13_39_02.csv",sep="\r\t",skiprows=68,encoding = "ISO-8859-1",index_col=0)
df.head()

不满意的输出: enter image description here

1 个答案:

答案 0 :(得分:1)

尝试一下:

df = pd.read_csv("Data 8199 2391 6_6_2019 13_39_02.csv", delimiter="\t", skiprows=68,
                 encoding="utf-16", index_col=0)
print(df.head())

输出:

                        Time  101 <RoomTemperature> (C)  ...  319 <DU5> (C)  320 (C)
Scan                                                      ...                        
1     06-06-2019 13:39:02:392                     21.170  ...         49.767   42.857
2     06-06-2019 13:39:32:376                     21.138  ...         49.944   43.253
3     06-06-2019 13:40:02:376                     21.116  ...         50.095   43.675
4     06-06-2019 13:40:32:376                     21.215  ...         50.227   44.085
5     06-06-2019 13:41:02:376                     21.234  ...         50.385   44.561