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

后端 未结 6 2006
后悔当初
后悔当初 2021-02-02 07:52

I have a DataFrame with about 25 columns, several of which hold data unsuitable for plotting. DataFrame.hist() throws errors on those. How can I specify that those columns sho

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 08:32

    I usually do the following:

    columns = [column for column in df.columns if df[column].dtype == 'float64']
    df = df[columns]
    

提交回复
热议问题