-
-
Save BinarySpoon/05f078030a05bf4280bb046e1375e473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# date sorting --> | |
df['date'] = date_list | |
form = (lambda date: datetime.strptime(date, "%m/%d/%Y")) | |
# sorting chronologically --> | |
df['index'] = sorted(range(len(date_list)), key=lambda x : form(date_list[x])) | |
# removing med notes column --> | |
df.drop('text', axis=1,inplace=True) | |
# final sorted series indices --> | |
final = list(df['index']) | |
final_series = pd.Series(final) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment