Pandas : Chaning date to a format where I can use `map`


Im trying to get current data in string format (Month-Date-Year)

def user_defined_function(date_str): I have a user defined function which takes input date(refresh_date) in the above mentioned format. So I need to change the today’s date to the required format and map it.

What I Tried :

   import datetime as dt
   from datetime import date'%m-%d-%Y')[0]

I am however getting an error using the above code AttributeError: 'str' object has no attribute 'map'

Asked By: Scope



Create a Series with your refresh_date variable:

refresh_date = pd.Series(['%m-%d-%Y')])
x =[0]
Answered By: Corralien
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.