Skip to content Skip to sidebar Skip to footer

Converting Pandas Dataframe To Pandas Series

I need some help with a data types issue. I'm trying to convert a pandas dataframe, which looks like the following: timestamp number 2018-01-01 1 2018-02-01 0 2018-03-01

Solution 1:

IIUC, use:

df.set_index('timestamp')['number'].rename_axis(None)

2018-01-01    1
2018-02-01    0
2018-03-01    5
2018-04-01    0
2018-05-01    6

Post a Comment for "Converting Pandas Dataframe To Pandas Series"