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

Time:04-28

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]

CodePudding user response:

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')
  • Related