How can I insert a list of values in a certain position of a dataframe with date time index under the condition that I want to insert the list after a certain value is > a certain number? Example below:
import pandas as pd
example_list = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5]
example_index = pd.date_range('2022-01-01', periods=120, freq='1min')
example_df = pd.DataFrame({'example values': np.arange(120)})
example_df.index = example_index
example_df
Output:
example values
2022-01-01 00:00:00 0
2022-01-01 00:01:00 1
2022-01-01 00:02:00 2
2022-01-01 00:03:00 3
2022-01-01 00:04:00 4
... ...
2022-01-01 01:55:00 115
2022-01-01 01:56:00 116
2022-01-01 01:57:00 117
2022-01-01 01:58:00 118
2022-01-01 01:59:00 119
I want to insert the example_list as a new column called
"example_values_2" at the position where the example_values>20. Is this possible?