'is there a way that i can convert this dataframe into a datatype [closed]

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:

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 1:[1]

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(timestamp, format='%b-%d-%Y %I:%M %p')
print(timstamp)

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1