Pandas Read CSV various datatypes


Example with a few more column-types (e.g. the column with the title MyBool contains True and False values and it is recognized as bool)

examples/pandas/mixed.csv
MyText,MyInteger,MyFloat,MyBool,MyExit
Joe,12,3.4,True,0
Jane,3,4,False,1
Mary,7,2.3,False,3


examples/pandas/mixed.py
import pandas as pd

df = pd.read_csv('mixed.csv')
print( df.dtypes )
print( df.describe() )

MyText        object
MyInteger      int64
MyFloat      float64
MyBool          bool
MyExit         int64
dtype: object
       MyInteger   MyFloat    MyExit
count   3.000000  3.000000  3.000000
mean    7.333333  3.233333  1.333333
std     4.509250  0.862168  1.527525
min     3.000000  2.300000  0.000000
25%     5.000000  2.850000  0.500000
50%     7.000000  3.400000  1.000000
75%     9.500000  3.700000  2.000000
max    12.000000  4.000000  3.000000