【问题标题】:Python 3.10.6 panda data frame dictionary values to comma separated stringPython 3.10.6 熊猫数据框字典值到逗号分隔的字符串
【发布时间】:2022-10-18 16:47:00
【问题描述】:

如何将熊猫数据框字典转换为逗号分隔的字符串?

products = df.T.to_dict().values()

示例数据print(f"{product.items()}")

dict_items([('Category', 'My Category'), ('Title', 'My Title'), ('Catalouge Reference Number/SKU', 'abc123'), ('countryOfOrigin', 'usa'), ('generalDescription', '0.0'), ('Lead Time', '10')])

【问题讨论】:

    标签: python-3.x dictionary


    【解决方案1】:

    IIUC 用途:

    [':'.join(x) for x in product.items()]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-31
      • 2020-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多