We have the following dataframe:
import pandas as pd
df_test = pd.DataFrame(data=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
index=['day1', 'day2', 'day3', 'day4', 'day5', 'day6', 'day7', 'day8', 'day9', 'day10'])
How can i replace multiple values in it based on index? For example, i wish that 'day9' and 'day10' rows receive the values of 'day1' and 'day2'.
I know we can do something like:
df_test.loc['day9'] = df_test.loc['day1']
df_test.loc['day10'] = df_test.loc['day2']
But if i have more data to replace, this wouldn't scale well. Not really sure how can i automate this process.