Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python pd.Timestamp add days

def add_days_to_date(date, days):
    '''Add days to a date and return the date.
    
    Args: 
        date (string): Date string in YYYY-MM-DD format. 
        days (int): Number of days to add to date
    
    Returns: 
        date (date): Date in YYYY-MM-DD with X days added. 
    '''
    
    add_date = pd.to_datetime(date) + timedelta(days=days)
    add_date = added_date.strftime("%Y-%m-%d")

    return added_date

date_addition = add_days_to_date('2021-01-01', 13)

print(date_addition)
$ '2021-01-14'
Comment

PREVIOUS NEXT
Code Example
Python :: tweepy auth 
Python :: numpy method to make polynomial model 
Python :: flatten list python 
Python :: python zip() 
Python :: sum of 1 to even numbers in python 
Python :: get user django 
Python :: python nominatim get latitude from address 
Python :: django url static 
Python :: python get current date and time 
Python :: print random integers 
Python :: python append variable to list 
Python :: how to create a dictionary in python 
Python :: Python Tkinter Button Widget Syntax 
Python :: extract all text from website using beautifulsoup and python 
Python :: method for detect that a float number is integer in python 
Python :: Visualize Decision Tree 
Python :: numpy declare arraylength 
Python :: list of dict values 
Python :: Adding labels to histogram bars in matplotlib 
Python :: python insert parent directory into sys path for import file purpose 
Python :: get definition of word python 
Python :: how to add csrf token in python requests 
Python :: selenium chrome options suppress warnings python 
Python :: how to append two numpy arrays 
Python :: how to know if the space button has been clicked in python pygame 
Python :: python get array from json 
Python :: time difference between two datetime.time 
Python :: how to split a string with newline in python 
Python :: python argv 
Python :: count occurrences of character in string python using dictionary 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =