【问题标题】:add column in dataframe在数据框中添加列
【发布时间】:2018-12-17 21:47:02
【问题描述】:

我需要在包含作者 ID 名称的数据框中添加一个名为 Id 的列,例如 Author-Id-001、Author-Id-002... 等等,直到 150。

我该怎么做?

提前致谢。 something like this(instead of Test-Document-00* I need Author-Id-00*

【问题讨论】:

标签: python pandas dataframe


【解决方案1】:

我认为需要:

df['Id'] = ['Author-Id-{:03d}'.format(x) for x in range(1, 151)]

【讨论】:

    猜你喜欢
    • 2021-01-11
    • 2021-07-09
    • 1970-01-01
    • 2022-09-24
    • 1970-01-01
    • 1970-01-01
    • 2021-07-30
    • 2018-01-19
    • 2019-08-12
    相关资源
    最近更新 更多