I have a single column dataframe 'new_list' like so:
list
0 LAX
1 CHI
2 HOU
that I am concatting to my 'global_list' dataframe which looks like this:
list src dest
0 LAX 1 0
1 CHI 0 1
to hopefully add 'HOU' as a row to 'global_list' while maintaining order like so:
list src dest
0 LAX 1 0
1 CHI 0 1
2 HOU NaN NaN
However, when I run global_list = pd.concat([global_list, new_list]).groupby('list', as_index=False).first()
I end up with the src and dest columns flipped (I assume because they are getting sorted alphabetically)
list dest src
0 LAX 0 1
1 CHI 1 0
2 HOU NaN NaN
I read up you can set a sort=False in the concat statement, but that solution is for a newer version of pandas (I am on 0.20.1 and can't update). Is there another way to maintain order when concatting for this older version of pandas?