python: calculate number of days from today date in a data frame

from datetime import datetime, timedelta
print datetime.now() + timedelta(days=5, hours=-5)

4.5
2
Phoenix Logan 186120 points

                                    df[['A','B']] = df[['A','B']].apply(pd.to_datetime) # If conversion required
df['C'] = (df['B'] - df['A']).dt.days

4.5 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
get days from datetime pandas date in number of days pandas pandas count days between dates get data for the past number of days from dataframe number of days between dates pandas python pandas timestamps greater than 5 days between two dates difference between clear date and due date in pandas python timestamp shift one day datetime pandas python day count python example datetime.timedelta(days = 1) how to gwet just the number of days from pd df pandas is two dates from today attributes of datetime in spyder datetime get days before today python python datetime the day before now + timedelta 1 day python timedelta python 1 day pandas find days python stop after period of time datetime shift date python back 1 day timestamp for one day python how to get number of day from datetime in pandas timedelta(days=1) subtract one day in sqlalchemy subtract one day sqlalchemy time time python one day ago background processing comparing date python subtract days from timestamp python python current date minus 7 days calcuate days from one column with one specific date pandas datetime.timedelta(days=1) python python minus one day difference between dates pandas pandas date difference in days pandas days difference between two dates difference days pandas take aways days from date time python datediff pandas python datafra,e calculate the day difference between two datetime python date extract shift of day pandas dataframe days between two dates python today minus 1 day pandas difference between dates time_period= pythong not wokring differnece between 2 dattimes in pandas in days pandas days between two dates how to get day before python date pandas how count days by column value pandas count days by values in column pandas number of days between two dates python: calculate number of days from today date in a data frame python 60 days range python datetime minus 1 day datetime flask
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source