You can do this with a MultiIndex, which can be done in various ways, but I always prefer using from_product()
.
Note that we will have to do some preparation before we can do this. We have to make sure the index is properly set on the original DataFrame, and we have to elongate the original DataFrame to allow the new rows.
import pandas as pd
df = pd.DataFrame({'date': ['2020/01/01', '2020/01/02', '2020/01/03'], 'p': [123, 231, 188]})
df = df.set_index('date')
sigma = [0, 1, 2, 5]
# Create new 2-level index
multi_index = pd.MultiIndex.from_product([sigma, df.index], names=['sigma', 'date'])
# Make longer
df = pd.concat([df] * len(sigma))
# Set new index
df = df.set_index(multi_index)
# Print result
print(df.head())
>>> p
>>> sigma p
>>> 0 2020/01/01 123
>>> 2020/01/02 231
>>> 2020/01/03 188
>>> 1 2020/01/01 123
>>> 2020/01/02 231
If you want to make new columns or use the index values, you can get those with get_level_values()
like this:
df["p*sigma"] = df.index.get_level_values("sigma") * df["p"]
print(df.head())
>>> p p*sigma
>>> sigma date
>>> 0 2020/01/01 123 0
>>> 2020/01/02 231 0
>>> 2020/01/03 188 0
>>> 1 2020/01/01 123 123