I need to fill the data frame gradually. in each step, I have the data like this:
pubid = 1
keywords = [2, 2,3]
knowing that length of values for each column are not equal how can I form the data frame like this:
pubid keyword
1 2
1 2
1 3
So next time when my new data is coming and is like this:
pubid = 6
keywords = [10, 11]
my data frame has become as shown:
pubid keyword
1 2
1 2
1 3
6 10
6 11
I tried to create the temp dataframe at every beginning and add some values like this:
data = {'pubid': 1, 'keywords':[1]}
df = pd.DataFrame(data)
pubid = 3
keyword = [2, 3]
df['pubid'] = 3
df["keywords"] = df["pubid"].apply(lambda x: i for i in keyword)
It does not work in that way, but don't know how to solve it.