I pulled my data from a very poorly formatted csv file and am trying to do some cleaning. Right now I have values in one column that incorrectly correspond to another and I need to shift the values in only one column so they correctly correspond.
My data looks roughly like this:
df =
ref name address
1 1.2 name1
2 1.2 address1
3 1.3 name2
4 1.3 name2
5 1.3 address2
6 1.3 address2
7 1.4 name3
8 1.4 name3
9 1.5 name4
10 1.5 address4
And continuing like so with sometimes two address or three or four for about another thousand rows.
Ideally, I'd like to make it so my data looks like this:
df =
ref name address
1 1.2 name1 address1
3 1.3 name2 address2
4 1.3 name2 address2
5 1.4 name3
6 1.4 name3
7 1.5 name4 address4
with the null rows removed and the addresses shifted up to properly correspond. Please let me know if you have you have any ideas on how to do this, it's been giving me a lot of trouble. Thanks in advance.