Answering your question about .str.split(...) :
in .str.split(..., expand=False) by default expand=False , i.e. it will return pandas.Series where the items are lists:
In [49]: df.date.str.split('/') Out[49]: 0 [2016, 01, 09] 1 [2016, 11, 11] 2 [2016, 12, 30] Name: date, dtype: object
if you specify expand=True , then pandas.DataFrame will return:
In [50]: df.date.str.split('/', expand=True) Out[50]: 0 1 2 0 2016 01 09 1 2016 11 11 2 2016 12 30
you can still use .str.extract() and specify the column names:
In [51]: df.date.str.extract(r'(?P<year>\d{4})[-/\.](?P<month>\d{2})[-/\.](?P<day>\d{2})', expand=True) Out[51]: year month day 0 2016 01 09 1 2016 11 11 2 2016 12 30 In [52]: split = df.date.str.extract(r'(?P<year>\d{4})[-/\.](?P<month>\d{2})[-/\.](?P<day>\d{2})', expand=True) In [53]: split Out[53]: year month day 0 2016 01 09 1 2016 11 11 2 2016 12 30
views.Date.strshow. - Nikmoonviews.Date = pd.to_datetime(views.Date)and you don’t need to divide anything and collect it again indatetime- MaxU