So I am trying to repeat all the cells 3 times (except the last cell because the rows will increase by 3) in a certain column without increasing the number of rows. I think my question would be clear by showing an example.
The data that is printed :
| Time | OpenPrice15Min | OpenPrice1Hour |
|---|---|---|
| 1:00:00 | 200 | 200 |
| 1:15:00 | 230 | |
| 1:30:00 | 180 | |
| 1:45:00 | 195 | |
| 2:00:00 | 350 | 350 |
| 2:15:00 | 174 | |
| 2:30:00 | 230 | |
| 2:45:00 | 180 | |
| 3:00:00 | 195 | 195 |
What I want the data to look like:
| Time | OpenPrice15Min | OpenPrice1Hour |
|---|---|---|
| 1:00:00 | 200 | 200 |
| 1:15:00 | 230 | 200 |
| 1:30:00 | 180 | 200 |
| 1:45:00 | 195 | 200 |
| 2:00:00 | 350 | 350 |
| 2:15:00 | 174 | 350 |
| 2:30:00 | 230 | 350 |
| 2:45:00 | 180 | 350 |
| 3:00:00 | 195 | 195 |
This is my Dataframe script (not the full script). Sdata and S2data is defined and gets the data from Binance exchange. sdf2 is another dataframe that I get the OPEN-1H from as OpenPrice1Hour.
sdf2 = pd.DataFrame(S2data)
sdf2[0] = pd.to_datetime(sdf2[0],unit='ms')
sdf2.columns = ['Time','OPEN-1H']
sdf2 = sdf2.set_index('Time')
sdf2["OPEN-1H"] = pd.to_numeric(sdf2["OPEN-1H"])
sdf = pd.DataFrame(Sdata)
sdf[0] = pd.to_datetime(sdf[0],unit='ms')
sdf.columns = ['Time','OpenPrice15min']
sdf = sdf.set_index('Time')
sdf["OpenPrice15min"] = pd.to_numeric(sdf["Open-15Min"])
sdf['OpenPrice1Hour'] = pd.to_numeric(sdf2["Open-1H"])
print(sdf)