I have the following lines of code to change the type of data in pandas DataFrame columns:
X["AIRLINE_ARR_ICAO"] = X["AIRLINE_ARR_ICAO"].apply(lambda x: str(x))
X["WAKE"] = X["WAKE"].apply(lambda x: str(x))
X["PLANNED_TURNAROUND"] = X["PLANNED_TURNAROUND"].apply(lambda x: float(str(x)))
But I get an error:
A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
I can overcome this warming by doing X1 = X.copy()
, but it may leak to a memory leak.