【问题标题】:Pandas concat producing NaN熊猫 concat 产生 NaN
【发布时间】:2014-06-15 01:57:14
【问题描述】:

我有一系列使用 read_csv 导入的 CSV

每个 csv 的结构如下:

lig1,-6.3
lig2,-6.5

通过读取所有文件,并将每个导入关联到一个键,我一直在尝试:

df = []
for conf in FOLDER:
    df.append(pd.read_csv(conf+'/summary.csv', names=['ligand', self.__getDirNameFromPath(conf)]))

print pd.concat(df)

我明白了:

我想基本上删除 NaN,在这种情况下应该有两行(不包括标题)。另外,将配体列作为索引也很好。

提前致谢

【问题讨论】:

    标签: python pandas concat


    【解决方案1】:

    我想你想要concat(df, axis=1)

    【讨论】:

    • Arg,我发誓我试过了,但它出错了,谢谢。同样对于任何查看此内容的人,我通过传递 index_col=0 将配体列作为索引。
    猜你喜欢
    • 1970-01-01
    • 2012-09-29
    • 2018-07-05
    • 2021-12-15
    • 2014-01-29
    • 1970-01-01
    • 1970-01-01
    • 2022-07-09
    • 2017-03-13
    相关资源
    最近更新 更多