Split list into columns Pandas

Solution 1:

What if you create dict with keys the strings and values the lists from this list. For example every time you find a string create a new key and then append to it:

last_key = None
my_dict = {}
for i in my_list:
    if not (i.isnumeric() or i == '-'):
        last_key = i
    elif last_key in my_dict:
        my_dict[last_key].append(i)
    else:
        my_dict[last_key] = [i]
print(my_dict)

Then just create the dataframe:

my_df = pd.DataFrame(my_dict)