How to check the data type of DataFrame Columns in Pandas?
Determine DataFrame Columns DataType:
import pandas as pd df = pd.DataFrame({'Age': [30, 20, 22, 40, 32, 28, 39], 'Color': ['Blue', 'Green', 'Red', 'White', 'Gray', 'Black', 'Red'], 'Food': ['Steak', 'Lamb', 'Mango', 'Apple', 'Cheese', 'Melon', 'Beans'], 'Height': [165, 70, 120, 80, 180, 172, 150], 'Score': [4.6, 8.3, 9.0, 3.3, 1.8, 9.5, 2.2], 'State': ['NY', 'TX', 'FL', 'AL', 'AK', 'TX', 'TX'] }, index=['Jane', 'Nick', 'Aaron', 'Penelope', 'Dean', 'Christina', 'Cornelia']) print(df.dtypes)
C:\python\pandas examples>python example16.py Age int64 Color object Food object Height int64 Score float64 State object dtype: object C:\python\pandas examples>
2018-12-08T20:01:41+05:30
2018-12-08T20:01:41+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution