Hi
I am unsure why the following works in a jupyter notebook, but not in a python script that I am run from the Linux command line:
I am unsure why the following works in a jupyter notebook, but not in a python script that I am run from the Linux command line:
#!/usr/bin/python3 import pandas as pd import numpy as np # SWAPPING COLUMNS dates=pd.date_range('1/1/2019',periods=12) df=pd.DataFrame(np.random.randn(12,4),index=dates,columns=['A','B','C','D']) df_copy=df.copy() # assign, after converting to raw data df_copy.loc[: ['B', 'A']]=df_copy[['A','B']].to_numpy() print(df_copy)Any suggestions ?
logoslog