I have a pandas dataframe (indicators) that includes a column ('ind_df') in which the values are themselves dataframes. I want to multiply the values of one of those dataframes (located in the 'number_of_people_in_poverty' row of the indicators dataframe) by 1,000,000.
type(indicators)
# pandas.core.frame.DataFrame
type(indicators.loc['number_of_people_in_poverty']['ind_df'])
# pandas.core.frame.DataFrame
type(indicators.loc['number_of_people_in_poverty']['ind_df'] * 1000000)
# pandas.core.frame.DataFrame
indicators.loc['number_of_people_in_poverty']['ind_df'] = \
indicators.loc['number_of_people_in_poverty']['ind_df'] * 1000000
indicators.loc['number_of_people_in_poverty']['ind_df']
# returns unchanged dataframe, not multiplied by 1000000
The operation on the right side of the assignment indeed returns an identical dataframe with all of its values multiplied by 1mil.
But, this dataframe doesn't replace the dataframe on the left side of the assignment. The values in that dataframe remain unchanged.
Why??