I have a data frame that looks something like:
import pandas as pd
import numpy as np
f = {'business':['#','FX','IR'],
'AL':['A','L','#'],
'Company':['207','#','1']}
filterr = pd.DataFrame(data=f)
filterr
Whenever there is a '#' present in the dataframe, I need the rows to repeat based on every combination from a list.The set of list that I have looks something like:
business=['FX','IR']
AL=['A','L']
Company=['1','207']
So, The end result I am looking for looks something like:
f1 = {'business':['FX','IR','FX','FX','IR','IR'],
'AL':['A','A','L','L','A','L'],
'Company':['207','207','1','207','1','1']
}
filter_output=pd.DataFrame(data=f1)
display(filter_output)
Any ideas on the most efficient way to do this ?
Thanks !!