I can confirm I set the index to my dataframe
df.set_index('time_date', inplace=True)
df.head()
Unnamed: 0 lid t_user_id collected_time latitude longitude altitude transportation_mode
time_date
2008-04-01 11:30:37-03:00 0 1 10 2008-04-01 11:30:37-03 39.475128 75.999173 -777.0 walk
2008-04-01 11:31:38-03:00 1 1 10 2008-04-01 11:31:38-03 39.474785 75.999100 -777.0 walk
2008-04-01 11:32:37-03:00 2 1 10 2008-04-01 11:32:37-03 39.474385 75.999417 -777.0 walk
2008-04-01 11:33:36-03:00 3 1 10 2008-04-01 11:33:36-03 39.473852 75.999690 -777.0 walk
2008-04-01 11:34:35-03:00 4 1 10 2008-04-01 11:34:35-03 39.473417 76.000253 -777.0 walk
However, everytime I pass the dataframe to a myclass object, I get this error message.
ts_obj = ts.TrajectorySegmentation(df)
ts_obj.load_data()
65 # sort data first
66 #self.raw_data=self.raw_data.sort_index()
---> 67 self.row_data['day'] = self.row_data.index.date
68
69 # preprocessing
AttributeError: 'Index' object has no attribute 'date'
Class definition:enter code here
class TrajectorySegmentation:
def __init__(self, rowData=pd.DataFrame()):
self.row_data = rowData
def load_data(self, **kwargs):
src = self.row_data
I cannot figure out what wrong with the line 67 in the library that python complain about, but here is fragment containing line 67
65 # sort data first
66 #self.raw_data=self.raw_data.sort_index()
67 self.row_data['day'] = self.row_data.index.date
68
EDIT
Tried one of the answers, same error, screenshot:

EDIT-2
sample data
!cat sample.csv
time_date,Unnamed: 0,lid,t_user_id,collected_time,latitude,longitude,altitude,transportation_mode
2008-04-01 11:30:37-03:00,0,1,10,2008-04-01 11:30:37-03,39.47512800000001,75.999173,-777.0,walk
2008-04-01 11:31:38-03:00,1,1,10,2008-04-01 11:31:38-03,39.474785,75.9991,-777.0,walk
2008-04-01 11:32:37-03:00,2,1,10,2008-04-01 11:32:37-03,39.474385,75.99941700000002,-777.0,walk
2008-04-01 11:33:36-03:00,3,1,10,2008-04-01 11:33:36-03,39.473852,75.99969,-777.0,walk
2008-04-01 11:34:35-03:00,4,1,10,2008-04-01 11:34:35-03,39.473417,76.000253,-777.0,walk
