【问题标题】:How to get specific values from dataframe using attributes in the columns in python如何使用python中列中的属性从数据框中获取特定值
【发布时间】:2018-07-18 11:10:17
【问题描述】:

我的数据框看起来像这样。

我只想要福特、本田和 amc 的值。有什么办法可以得到这些值。

我试过了,但它不起作用。 x= grouped["ford", "buick" , "honda"].agg([np.min, np.max, np.mean])

【问题讨论】:

标签: python-3.x jupyter-notebook


【解决方案1】:

你需要这样的东西。

brand=["ford", "buick" , "honda"]

df_new=df[df['brands'].isin(brand)]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多