The Swap That Never Happened
A cleanup script tries to swap two columns in place.
df = pd.DataFrame({"A": [1, 2], "B": [10, 20]})
df.loc[:, ["B", "A"]] = df[["A", "B"]]
print(df.to_dict("list"))
What prints?
Sign in to answer questions and track your progress
Sign In