One example how this could be handled:
import pandas as pd
l = [
['8HP70'],
['Production/Day'],
['Production/Month'],
['Cum.Production'],
['8HP70X'],
['Production/Day'],
['Production/Month'],
['Cum.Production'],
['8HP75'],
['Production/Day'],
['Production/Month'],
['Cum.Production'],
]
df = pd.DataFrame(l, columns=['Column B'])
## repeating product label for every 4 rows
products = df[df['Column B'].index % 4 == 0]
## replicating to a new column
df['Column A'] = products.values.repeat(4)
## removing the product duplication
df = df[df['Column A']!=df['Column B']]
Out[3]:
Column B Column A
1 Production/Day 8HP70
2 Production/Month 8HP70
3 Cum.Production 8HP70
5 Production/Day 8HP70X
6 Production/Month 8HP70X
7 Cum.Production 8HP70X
9 Production/Day 8HP75
10 Production/Month 8HP75
11 Cum.Production 8HP75
EDIT
Added some more logic as further requested. If there are noisy rows before and all the way to the first product label, we can just remove, perform our logic and re-append (assuming we know the first product label):
df = pd.DataFrame(l, columns=['Column B'])
## Identify product starting location
prod_label = '8HP70'
## Get index of where first prod appear
prod_indic = df[df['Column B'] == prod_label].index[0]
## create a temp df only with product info
only_prod_df = df[df.index>=prod_indic].reset_index(drop=True)
products = only_prod_df[only_prod_df['Column B'].index % 4 == 0]
## replicating to a new column
only_prod_df['Column A'] = products.values.repeat(4)
## removing the product duplication
only_prod_df = only_prod_df[only_prod_df['Column A']!=only_prod_df['Column B']]
## append back to noisy rows
final_df = pd.concat([df[df.index<prod_indic], only_prod_df],
axis=0, sort=False, ignore_index=True)
Column B Column A
0 noise NaN
1 noise NaN
2 noise NaN
3 Production/Day 8HP70
4 Production/Month 8HP70
5 Cum.Production 8HP70
6 Production/Day 8HP70X
7 Production/Month 8HP70X
8 Cum.Production 8HP70X
9 Production/Day 8HP75
10 Production/Month 8HP75
11 Cum.Production 8HP75
Also important to note this piece relies on a sequential numeric index.