pandas converters example

Solutions on MaxInterview for pandas converters example by the best coders in the world

showing results for - "pandas converters example"
Juana
16 Apr 2016
1In [5]:
2pd.read_csv(io.StringIO(t), converters={'date':pd.to_datetime}).info()
3
4<class 'pandas.core.frame.DataFrame'>
5Int64Index: 1 entries, 0 to 0
6Data columns (total 4 columns):
7int      1 non-null int64
8float    1 non-null float64
9date     1 non-null datetime64[ns]
10str      1 non-null int64
11dtypes: datetime64[ns](1), float64(1), int64(2)
12memory usage: 40.0 bytes
13
Santiago
20 Nov 2019
1In [3]:    
2df = pd.read_csv(io.StringIO(t), dtype=object).info()
3
4<class 'pandas.core.frame.DataFrame'>
5Int64Index: 1 entries, 0 to 0
6Data columns (total 4 columns):
7int      1 non-null object
8float    1 non-null object
9date     1 non-null object
10str      1 non-null object
11dtypes: object(4)
12memory usage: 40.0+ bytes
13
Kean
30 Apr 2019
1In [6]:
2pd.read_csv(io.StringIO(t), dtype={'int':'object'}, parse_dates=['date']).info()
3
4<class 'pandas.core.frame.DataFrame'>
5Int64Index: 1 entries, 0 to 0
6Data columns (total 4 columns):
7int      1 non-null object
8float    1 non-null float64
9date     1 non-null datetime64[ns]
10str      1 non-null int64
11dtypes: datetime64[ns](1), float64(1), int64(1), object(1)
12memory usage: 40.0+ bytes
13