【问题标题】:tPlotting scatter_matrix with selected columns from panda dataframe using scatter_matrix(dataset)tPlotting scatter_matrix 使用 scatter_matrix(dataset) 从 panda 数据帧中选择列
【发布时间】:2017-07-03 11:40:04
【问题描述】:

我首先提到了这个问题(但我想要一个散点矩阵):

How do I exclude a few columns from a DataFrame plot?

但我不想排除列,而是从大约 25 个列表中包含 4 个列。而且由于我打算选择的列不在附近,切片也可能很麻烦。

例如:假设这是我的标题列表:

['x1', 'x2', 'y1', 'y2', 'url', 'type', 'token', 'slotId', 'distance',     'workerId', 'projectId', 'timestamp', 'scheduleId', 'timeEntryId', 'endTimestamp', 'browserVersion', 'scheduleEndTime', 'scheduleStartTime', 'x', 'y', 'btn', 'keyType', 'taskId', 'url_domain']

我想要 x1,y1,yrl,distance,timestamp 和 taskId 的 scatter_matrix。

提前谢谢你。

【问题讨论】:

  • 您可以添加具有所需输出的数据样本吗?

标签: python pandas matplotlib dataframe


【解决方案1】:

您只能在该函数中传递那些选定的列:

scatter_matrix(dataset_name[['x1','y1','yrl','distance','timestamp','taskId']])

【讨论】:

    猜你喜欢
    • 2018-03-18
    • 1970-01-01
    • 2017-10-10
    • 2014-05-21
    • 1970-01-01
    • 2017-11-19
    • 2021-08-18
    • 1970-01-01
    • 2023-03-09
    相关资源
    最近更新 更多