Sorry if this is a really dumb question. I'm a total noob at pandas and can't even figure out what key words to use to search for a solution for the problem I have.
Basically, I have a numeric data frame,
numeric_df = pd.DataFrame({"colA": [1.23, 2.34, 3.45],
"colB":[1.00, 2.00, 3.00]})
Now I create a second df that duplicates the value of numeric_df
formatted_df = numeric_df
Then I format the two columns in "formatted_df" according my needs, I'm doing it this way because I want to keep the values in numeric_df as numbers, so I can operate on them later.
formatted_df["colA"] = formatted_df["colA"].map("${:}".format)
formatted_df["colB"] = formatted_df["colB"].map("{:}Years".format)
But now, if I view numeric_df, its columns are already formatted and converged into a string. What is causing the problem? Why does my map method modify the original data frame?
Thank you in advance for any help you can give.