user1922994
user1922994

Reputation: 13

All Pandas Data Types

I am trying to write a function that will subset a pandas dataframe based on the data type; essentially I am trying to split on numerical and non-numerical columns.

I have gotten as far as:

data.dtypes

This returns the types of each column, however I cannot find a list of all possible types. Currently it seems to me that all non-numerical columns are type 'object', is this the case?

Thanks

Upvotes: 1

Views: 839

Answers (1)

Phillip Cloud
Phillip Cloud

Reputation: 25652

Pandas uses datetime64, timedelta64, int64, float64, bool and object (this includes strings and any other custom objects). You can use other types such as float32, and pandas will try to maintain it, but some operations will implicitly cast to e.g., float64.

Upvotes: 2

Related Questions