How to determine whether a column/variable is numeric or not in Pandas/NumPy?

后端 未结 9 2002
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 02:47

Is there a better way to determine whether a variable in Pandas and/or NumPy is numeric or not ?

I have a self defined

9条回答
  •  旧时难觅i
    2020-12-01 02:51

    Pandas has select_dtype function. You can easily filter your columns on int64, and float64 like this:

    df.select_dtypes(include=['int64','float64'])
    

提交回复
热议问题