I currently have a text data file that is just a list of strings separated by newlines. The data is listed in groups so that all values belonging to one group are listed beneath the group title. All of the group titles with their values are listed consecutively.
When I use the following basic code to load it I end up with something looking like this.
df = pd.load_csv('file.txt', header = None, sep = '\n')
0
0 Group One []
1 John
2 Jacob
3 James
4 Group Two []
5 Mary
6 Molly
7 Group Three []
8 Anthony
9 Alan
The Group labels should actually be their own column and correspond to the values underneath them. So the format I am trying to get would look like.
0 1
0 Group One John
1 Group One Jacob
2 Group One James
3 Group Two Mary
3 Group Two Molly
4 Group Three Anthony
5 Group Three Alan
I am struggling to figure out how to accomplish this.