Age | City | |
---|---|---|
0 | 21 | Tokyo |
When there is a data frame called.
python
df.dtypes == object
>>
Age False
City True
dtype: bool
python
df.loc[:, df.dtypes == object]
>>
Age City
0 21 Tokyo
python
mylist = list(df.select_dtypes(include = ['object']).columns)
mylist
>>
['City']
Recommended Posts