
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Arnab Chakraborty has Published 4293 Articles

Arnab Chakraborty
9K+ Views
To get the number of days from TimeDelta, use the timedelta.days property in Pandas. At first, import the required libraries −import pandas as pdTimeDeltas is Python’s standard datetime library uses a different representation timedelta’s. Create a Timedelta objecttimedelta = pd.Timedelta('5 days 1 min 45 s') Return the number of daystimedelta.daysExampleFollowing ... Read More

Arnab Chakraborty
162 Views
To return a components namedtuple-like, use the timedelta.components. At first, import the required libraries −import pandas as pdTimeDeltas is Python’s standard datetime library uses a different representation timedelta’s. Create a Timedelta objecttimedelta = pd.Timedelta('1 days 10 min 20 s') Return a components namedtuple-liketimedelta.componentsExampleFollowing is the code import pandas as pd ... Read More

Arnab Chakraborty
274 Views
To return a numpy timedelta64 array scalar view in nanoseconds, use the timedelta.asm8 property in Pandas.At first, import the required libraries −import pandas as pdExampleFollowing is the code import pandas as pd # TimeDeltas is Python’s standard datetime library uses a different representation timedelta’s # create a Timedelta object ... Read More

Arnab Chakraborty
4K+ Views
To get the weekday from Timestamp object, use the timestamp.weekday() method. At first, import the required libraries −import pandas as pd import datetimeSet the timestamp in Pandas. Create a Timestamp objecttimestamp = pd.Timestamp(datetime.datetime(2021, 5, 12)) Get the weekday of the year. Weekday is represented by number Monday == 0, Tuesday ... Read More

Arnab Chakraborty
2K+ Views
To get the UTC Offset Time, use the timestamp.utcoffset(). At first, import the required libraries −import pandas as pdCreating a timestamptimestamp = pd.Timestamp('2021-10-16T15:12:34.261811624', tz='UTC') New timestamp with UTC day and timetimestamp.utcnow()Get the UTC offset timetimestamp.utcoffset() ExampleFollowing is the code import pandas as pd # creating a timestamp timestamp = ... Read More

Arnab Chakraborty
294 Views
To return a new Timestamp representing UTC day and time, use the timestamp.utcnow() method. At first, import the required libraries −import pandas as pdCreating a timestamptimestamp = pd.Timestamp('2021-10-16T15:12:34.261811624', tz='UTC') New timestamp with UTC day and timetimestamp.utcnow()ExampleFollowing is the code import pandas as pd # creating a timestamp timestamp = ... Read More

Arnab Chakraborty
464 Views
To construct a naive UTC datetime from a POSIX timestamp, use the timestamp.utcfromtimestamp() method. Pass the POSIX as an argument.At first, import the required libraries −import pandas as pdCreate a timestamptimestamp = pd.Timestamp('2021-09-14T15:12:34.261811624') Constructing a naive UTC datetime from a POSIX timestamp. POSIX is passed as an argumenttimestamp.utcfromtimestamp(1631717502)ExampleFollowing is the ... Read More

Arnab Chakraborty
4K+ Views
To convert naive Timestamp to local time zone, use the timestamp.tz_locale(). Within that, set the timezone using the tz parameter.At first, import the required libraries −import pandas as pdCreating a naive timestamptimestamp = pd.Timestamp('2021-09-14T15:12:34.261811624') Add the timezonetimestamp.tz_localize(tz='Australia/Brisbane')ExampleFollowing is the code import pandas as pd # creating a naive timestamp ... Read More

Arnab Chakraborty
5K+ Views
Convert Timestamp to another time zone, use the timestamp.tz_convert(). Set the time zone as the parameter. At first, import the required libraries −import pandas as pdCreate the timestamp object in Pandas. We have also set the timezonetimestamp = pd.Timestamp('2021-10-14T15:12:34.261811624', tz='US/Eastern') Convert timezone of timestamptimestamp.tz_convert('Australia/Brisbane'))ExampleFollowing is the code import pandas as ... Read More

Arnab Chakraborty
267 Views
To return proleptic Gregorian ordinal, use the timestamp.toordinal() method. At first, import the required libraries −import pandas as pdCreate the timestamp object in Pandastimestamp = pd.Timestamp(2021, 9, 18, 11, 50, 20, 33) Return proleptic Gregorian ordinal. Example: January 1 of year 1 is day 1timestamp.toordinal()ExampleFollowing is the code import pandas ... Read More