【问题标题】:How can I turn this list of strings into a dataframe in pandas如何将此字符串列表转换为熊猫中的数据框
【发布时间】:2021-12-08 13:45:55
【问题描述】:

好吧,基本上我使用 bioservices 包从在线数据库中提取了大量值。如果使用 pandas 将此字符串列表转换为数据框,我想做什么,然后我可以进一步格式化。

this is my extracted list of values from the online database that I want to turn into a pandas datafram

【问题讨论】:

  • 你想要的输出是什么?为达到目标做了什么尝试?

标签: python pandas bioservices


【解决方案1】:

这应该适合你。只需将我的列表替换为您的列表即可。

import pandas as pd
d = ['your', 'list']
df = pd.DataFrame(columns= ['col1'],
                  data=d)
print(df)

【讨论】:

  • 非常感谢您的回答,我觉得我真的很接近您的代码,但不幸的是我收到一个错误,上面写着“raise ValueError("DataFrame constructor not proper called!") ValueError : 未正确调用 DataFrame 构造函数!
  • 这可能与您的数据是字符串这一事实有关。这可能会对您有所帮助。 stackoverflow.com/questions/25604115/…
猜你喜欢
  • 2018-11-23
  • 2021-03-22
  • 2019-10-12
  • 1970-01-01
  • 1970-01-01
  • 2019-04-16
  • 2022-01-19
  • 2017-12-12
  • 2018-11-25
相关资源
最近更新 更多