Let's say I want to convert a series of date strings to datetime using the following:
>>> import pandas as pd >>> dataframe.loc[:, 'DATE'] = pd.to_datetime(dataframe.loc[:, 'DATE']) Now, I see dataframe.loc[:, 'DATE'] as redundant. Is it possible in python that I call a function on an object and assign the return to the same object at the same time?
Something that looks like:
>>> pd.to_datetime(dataframe.loc[:,'DATE'], +) or
dataframe.loc[:,'DATE'] += pd.to_datetime() where + (or whatever) assigns the return of the function to its first argument
This question might be due to my lack of understanding on how programming languages are written/function, so please be gentle.