
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
Found 26504 Articles for Server Side Programming

162 Views
To create a PeriodIndex, use the pandas.PeriodIndex() method. Get the days of the week using the PeriodIndex.dayofweek property.At first, import the required libraries −import pandas as pdCreate a PeriodIndex object. PeriodIndex is an immutable ndarray holding ordinal values indicating regular periods in time. We have set the frequency using the "freq" parameter −periodIndex = pd.PeriodIndex(['2018-07-25', '2019-10-30', '2020-11-20', '2021-09-15', '2022-03-12', '2023-06-18'], freq="D")Display PeriodIndex object −print("PeriodIndex...", periodIndex) Display day of the week from the PeriodIndex object. Days of week are displayed as Monday=0, Tuesday=1 ... Sunday=6 −print("Days of the week from the PeriodIndex...", periodIndex.dayofweek)ExampleFollowing is the code −import pandas as pd ... Read More

1K+ Views
To create a PeriodIndex, use the pandas.PeriodIndex() method. Get the days of the period using the PeriodIndex.day property.At first, import the required libraries −import pandas as pdCreate a PeriodIndex object. PeriodIndex is an immutable ndarray holding ordinal values indicating regular periods in time. We have set the frequency using the "freq" parameter −periodIndex = pd.PeriodIndex(['2018-07-25', '2019-10-30', '2020-11-20', '2021-09-15', '2022-03-12', '2023-06-18'], freq="D")Display PeriodIndex object −print("PeriodIndex...", periodIndex) Display day from the PeriodIndex object −print("The number of days from the PeriodIndex...", periodIndex.day)ExampleFollowing is the code −import pandas as pd # Create a PeriodIndex object # PeriodIndex is an immutable ndarray holding ordinal ... Read More

2K+ Views
To create a PeriodIndex, use the pandas.PeriodIndex() method. To set the frequency, use the freq parameter.At first, import the required libraries −import pandas as pdCreate a PeriodIndex object. PeriodIndex is an immutable ndarray holding ordinal values indicating regular periods in time. We have set the frequency using the "freq" parameter −periodIndex = pd.PeriodIndex(['2021-09-25', '2020-10-30', '2020-11-20'], freq="D") Display PeriodIndex object −print("PeriodIndex...", periodIndex)ExampleFollowing is the code −import pandas as pd # Create a PeriodIndex object # PeriodIndex is an immutable ndarray holding ordinal values indicating regular periods in time # We have set the frequency using the "freq" parameter periodIndex = ... Read More

147 Views
To create a DataFrame from the TimeDeltaIndex object, use the TimeDeltaIndex to_frame() method. Override the name of the resulting column using the name parameter.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Create a DataFrame from TimeDeltaIndex object. The original index isn't set in the returned DataFrame using the 'False' parameter. To override the name of the resulting column, we have used the 'name' parameter −print("TimeDeltaIndex to DataFrame...", tdIndex.to_frame(index=False, ... Read More

123 Views
To create a DataFrame from the TimeDeltaIndex object, use the TimeDeltaIndex to_frame() method. Ignore the original index using the index parameter with value False.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Create a DataFrame from TimeDeltaIndex object. The original index isn't set in the returned DataFrame using the 'False' parameter −print("TimeDeltaIndex to DataFrame...", tdIndex.to_frame(index=False))ExampleFollowing is the code −import pandas as pd # Create a TimeDeltaIndex object # ... Read More

123 Views
To perform ceil operation on the TimeDeltaIndex with milliseconds frequency, use the TimeDeltaIndex.ceil() method. For milliseconds frequency, use the freq parameter with value ‘ms’.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Ceil operation on TimeDeltaIndex date with milliseconds frequency. For milliseconds frequency, we have used 'ms' −print("Performing Ceil operation with milliseconds frequency...", tdIndex.ceil(freq='ms'))ExampleFollowing is the code −import pandas as pd # Create a TimeDeltaIndex object # We ... Read More

140 Views
To perform ceil operation on the TimeDeltaIndex with microseconds frequency, use the TimeDeltaIndex.ceil() method. For microseconds frequency, use the freq parameter with value ‘us’.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Ceil operation on TimeDeltaIndex date with microseconds frequency. For microseconds frequency, we have used 'us' −print("Performing Ceil operation with microseconds frequency...", tdIndex.ceil(freq='us'))ExampleFollowing is the code −import pandas as pd # Create a TimeDeltaIndex object # We ... Read More

102 Views
To perform ceil operation on the TimeDeltaIndex with seconds frequency, use the TimeDeltaIndex.ceil() method. For seconds frequency, use the freq parameter with value ‘S’.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Ceil operation on TimeDeltaIndex date with seconds frequency. For seconds frequency, we have used 'S' −print("Performing Ceil operation with seconds frequency...", tdIndex.ceil(freq='S'))ExampleFollowing is the code −import pandas as pd # Create a TimeDeltaIndex object # We ... Read More

104 Views
To perform ceil operation on the TimeDeltaIndex with minutely frequency, use the TimeDeltaIndex.ceil() method. For minutely frequency, use the freq parameter with value ‘T’.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Ceil operation on TimeDeltaIndex date with minutely frequency. For minutely frequency, we have used 'T' −print("Performing Ceil operation with minutely frequency...", tdIndex.ceil(freq='T'))ExampleFollowing is the code −import pandas as pd # Create a TimeDeltaIndex object # We ... Read More

86 Views
To perform ceil operation on the TimeDeltaIndex with hourly frequency, use the TimeDeltaIndex.ceil() method. For hourly frequency, use the freq parameter with value ‘H’.At first, import the required libraries −import pandas as pdCreate a TimeDeltaIndex object. We have set the timedelta-like data using the 'data' parameter −tdIndex = pd.TimedeltaIndex(data =['4 day 8h 20min 35us 45ns', '+17:42:19.999999', '9 day 3h 08:16:02.000055', '+22:35:25.000075'])Display TimedeltaIndex −print("TimedeltaIndex...", tdIndex)Performing Ceil operation on TimeDeltaIndex date with hourly frequency. For hourly frequency, we have used 'H' −print("Performing Ceil operation with hourly frequency...", tdIndex.ceil(freq='H'))ExampleFollowing is the code −import pandas as pd # Create a TimeDeltaIndex object # ... Read More