【问题标题】:How to skip Column title row in Pandas DataFrame [duplicate]如何跳过 Pandas DataFrame 中的列标题行 [重复]
【发布时间】:2019-10-18 20:09:03
【问题描述】:

如何在 Pandas DataFrame 中跳过列标题行

我的代码:

sample = pd.DataFrame(pd.read_csv('Fremont TMY_Sample_Original.csv', `Import csv`low_memory=False))

sample_header = sample.iloc[:1, 0:20] `Wants to separate first two row because these are different data at start `
sample2 = sample[sample.iloc[:, 0:16] `wants to take required data for next process`
sample2 = ('sample2', (header=False)) `Trying to skip column title row`
print(sample2)

预期输出:

举个例子

全年数据(此行我想删除并保留我想保留的行)

Date  Time(Hour) WindSpeed(m/s)

0  5    1            10

1  4    2            17

2  6    3            16

3  7    4            11

【问题讨论】:

  • 请展示您的数据框和预期输出的示例

标签: python pandas


【解决方案1】:

这应该可以工作

  • df = pd.read_csv("yourfile.csv", header = None)

【讨论】:

    猜你喜欢
    • 2019-11-26
    • 2019-07-19
    • 1970-01-01
    • 2015-12-13
    • 2018-01-02
    • 2014-07-16
    • 1970-01-01
    • 2014-11-26
    相关资源
    最近更新 更多