【问题标题】:Addressing specific named dataset columns处理特定的命名数据集列
【发布时间】:2021-06-02 14:20:55
【问题描述】:

所以,最近我开始使用 jupyter notebook 处理数据集。我一直在想,如果我不知道它们的名字,我该如何处理列或行?我知道它应该类似于 Data["name"],但我不确定是否可以采取任何不同的方式?我一直在尝试像在 Python 中那样做,但它总是以错误告终。

TypeError                                 Traceback (most recent call last)
<ipython-input-11-7005df7eac4b> in <module>
      2 data = list(frame['data'])
      3 target = (frame['target'])
----> 4 wine_frame = pd.DataFrame(frame['data':3])
      5 wine_frame['target'] = frame['target':3]
      6 sns.pairplot(wine_frame, hue='target')

TypeError: unhashable type: 'slice'

【问题讨论】:

标签: python pandas jupyter-notebook dataset


【解决方案1】:

不知道列名不是一件好事,特别是如果你将它用于数据分析师,pandas 有很多内置功能。你可以使用。在 jupyter notebook 中你可以分配变量来保持值

Value = df.columns

你可以在谷歌上找到很多这样的东西 enter link description here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-26
    • 1970-01-01
    • 2021-10-08
    • 2020-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多