Python, Pandas To Add Columns From Calculation
A data frame like this and I am adding some columns from mapping and calculation. code month of entry name reports 0 JJ 20171002 Jason 14 1 MM 201712
Solution 1:
You need copy
:
df1 = df[df['name_code'].isin(wanted)].copy()
If you modify values in df1
later you will find that the modifications do not propagate back to the original data (df
), and that Pandas does warning.
Post a Comment for "Python, Pandas To Add Columns From Calculation"