Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

is there a way that i can convert this dataframe into a datatype

already clean a lot of information into this, and i’m feel stuck now, if anyone can give some ideas and how to proceed i will apreacite so much.

dates column

later i need to join with this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

dates and time column

and timezone abbr. ¿there’s a library or something that can handle datetypes like this?

my desired output is something like this: 2022-05-04 18:00:00 but i have this:

[have this]

>Solution :

As mentioned in the comment, you should make sure your dates are strings in order to concatenate them. You can do this like that:

df.column_name = df.column_name.astype(str)

After that you can use python’s datetime library to format it as dates.

date = 'May-02-2022'
time = '9:00 AM'
timestamp = a + ' ' + b
timestamp = pd.to_datetime(c, format='%b-%d-%Y %I:%M %p')
print(timstamp)

>>> Timestamp('2022-05-02 09:00:00')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading