create a dataframe column with n rows and static value

startAUM = 3
sim_runs = 3000
 
aumlist = []
for i in range(sim_runs):
  aumlist.append(startAUM)
  sAUM = pd.DataFrame(aumlist)
sAUM.columns = ["Month 0"]

I clearly overcomplicated this and made the script dog slow in the process.

All I am want is to have a single DataFrama with one column "Month 0" which has n rows (as defined by the variable sim_runs and each one of the rows containing the same number (as defined by startAUM)

​

Thanks

Posted Mar 9, 2022, 4:43 PM UTC

12
synthphreak•
import pandas as pd

month0 = [3] * 3000
df = pd.DataFrame(month0, columns=['Month 0'])
2
futuretraderOP•

hero!

2