I am trying to write this code in Python in Visual Studio. For some reason I cant get the code to align automatically. I wrote this code, based on Syntax, the code is not wrong but I cant get Python to create the Secondary_Key and based on my understanding its because the .assign doesnt align. So can someone help with understand why this is happening and how to get this resolved. The code I wrote this this. Final_df_With_Key = (Final_df .assign(Primary_Key = lambda df : df["Item-Color"] + "-" + df["DC"] + "-" + df["Subsidiary"] + "-" + df["Year"].astype(str) + "-" + df["Month"].astype(str) + "-" + df["B2B"]).assign(Secondary_Key = lambda df : df["Item-Color"] + "-" + df["DC"]) .loc[:,['Primary_Key'] + [col for col in Final_df.columns if col != 'Primary_Key']]) When I press enter before the .assign for the secondary key, the alignment becomes this. Final_df_With_Key = (Final_df .assign(Primary_Key = lambda df : df["Item-Color"] + "-" + df["DC"] + "-" + df["Subsidiary"] + "-" + df["Year"].astype(str) + "-" + df["Month"].astype(str) + "-" + df["B2B"]) .assign(Secondary_Key = lambda df : df["Item-Color"] + "-" + df["DC"]) .loc[:,['Primary_Key'] + [col for col in Final_df.columns if col != 'Primary_Key']]) I tried pressing tab and backspace but this wont automatically wont align, unless you press spacebar to get it to align. Please let me know you opinion on this. Continue reading...