Convert string type (date) into experiment type data
The original code can be run on someone else’s computer, but it won’t work with me
Error prompt: The
original code is as follows (some people may not report an error when using this code):
Solution:
Use the copy() function
Use loc to extract the column, the format is:
.loc[row name, column name] = value
The modified code is:
code block:
x = airline_selection.copy()
x.loc[:, 'LOAD_TIME'] = pd.to_datetime(x.loc[:, 'LOAD_TIME'])
x.loc[:, 'FFP_DATE'] = pd.to_datetime(x.loc[:, 'FFP_DATE'])
L = x.loc[:, 'LOAD_TIME'] - x.loc[:, 'FFP_DATE']
show result: