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
Server Side Programming Articles - Page 803 of 2650
119 Views
To return the count of increments applied on the CustomBusinessDay offset, use the CustomBusinessDay.n property in Pandas.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandas −timestamp = pd.Timestamp('2021-10-22 03:10:35') Create the CustomBusinessDay Offset −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 4, weekmask = 'Mon Tue Wed Fri')Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) Return the count of increments on the given CustomBusinessDay object −print("The count of increments on the CustomBusinessDay object..", cbdOffset.n)ExampleFollowing is the code −import pandas as pd # Set the timestamp object in Pandas timestamp ... Read More
98 Views
To return the rule code applied on the given CustomBusinessDay object, use the CustomBusinessDay.rule_code property in Pandas.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandas −timestamp = pd.Timestamp('2021-10-22 03:10:35') Create the CustomBusinessDay Offset .CustomBusinessDay is the DateOffset subclass representing custom business days excluding holidays −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 2, weekmask = 'Mon Tue Wed Fri')Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) Return the rule code of the frequency applied on the given CustomBusinessDay Offset −print("The rule code of the CustomBusinessDay object..", cbdOffset.rule_code)ExampleFollowing is the code ... Read More
147 Views
To check whether the CustomBusinessDay Offset has been normalized or not, use the CustomBusinessDay.normalize property in Pandas.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandas −timestamp = pd.Timestamp('2021-10-22 03:10:35') Create the CustomBusinessDay Offset. CustomBusinessDay is the DateOffset subclass representing custom business days excluding holidays. Weekmask of valid business days. We have normalized the CustomBusinessDay using the "normalize" parameter −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 2, weekmask = 'Mon Tue Wed Fri', normalize=True)Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) Check whether the CustomBusinessDay Offset is normalized or not ... Read More
121 Views
To return the name of the frequency applied on the given CustomBusinessDay offset object, use the CustomBusinessDay.name property.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandas −timestamp = pd.Timestamp('2021-12-31 08:35:10') Create the CustomBusinessDay Offset. CustomBusinessDay is the DateOffset subclass representing custom business days excluding holidays −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 2, weekmask = 'Mon Tue Wed Fri')Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) Return the name of the frequency applied on the given CustomBusinessDay object −print("The name of the frequency on the CustomBusinessDay object..", cbdOffset.name)ExampleFollowing is ... Read More
107 Views
To display the keyword arguments applied on the given CustomBusinessDay object, use the CustomBusinessDay.kwds property in Pandas.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandas −timestamp = pd.Timestamp('2021-12-31 08:35:10') Create the CustomBusinessDay Offset −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 2, weekmask = 'Mon Tue Wed Fri')Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) Display the keyword arguments −print("Keyword arguments on the given CustomBusinessDay Offset...", cbdOffset.kwds)ExampleFollowing is the code −import pandas as pd # Set the timestamp object in Pandas timestamp = pd.Timestamp('2021-12-31 08:35:10') # Display the ... Read More
102 Views
To return frequency applied on the given CustomBusinessDay Offset object as a string, use the CustomBusinessDay.freqstr property.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandas −timestamp = pd.Timestamp('2021-12-31 08:35:10') Create the CustomBusinessDay Offset −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 2, weekmask = 'Mon Tue Wed Fri')Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) Return frequency applied on the given CustomBusinessDay Offset object as a string −print("Frequency applied on the given CustomBusinessDay Offset object...", cbdOffset.freqstr)ExampleFollowing is the code −import pandas as pd # Set the timestamp object in ... Read More
453 Views
To create a CustomBusinessDay Offset object, use the pd.tseries.offsets.CustomBusinessDay() method in Pandas.At first, import the required libraries −import pandas as pdCreate the CustomBusinessDay Offset. CustomBusinessDay is the DateOffset subclass representing custom business days excluding holidays. Weekmask of valid business days −cbdOffset = pd.tseries.offsets.CustomBusinessDay(n = 5, weekmask = 'Mon Tue Wed Fri') Set the timestamp object in Pandas −timestamp = pd.Timestamp('2021-12-31 08:35:10')Add the offset to the Timestamp and display the Updated Timestamp −print("Updated Timestamp...", timestamp + cbdOffset) ExampleFollowing is the code −import pandas as pd # Set the timestamp object in Pandas timestamp = pd.Timestamp('2021-12-31 08:35:10') # Display the ... Read More
311 Views
We are given an integer array and the task is to firstly fetch the prefix of an array and then multiply it with -1, secondly calculate the prefix sum of an array and lastly find the maximum sum from the prefix array generated.Prefix array is generated as −First element of prefixArray[0] = first element of an arraySecond element of prefixArray[1] = prefixArray[0] + arr[1]Third element of prefixArray[2] = prefixArray[1] + arr[2]Fourth element of prefixArray[3] = prefixArray[2] + arr[3] …..etc.Let us see various input output scenarios for this -In − int arr[] = {2, 4, 1, 5, 2}Out − Prefix array is: ... Read More
620 Views
We are given a 2-D array of integer elements forming the matrix. The task is to calculate the count of minimum sum by pulling the submatrix from the matrix so formed.Let us see various input output scenarios for this -In −int matrix[size][size] = { {2, 3, -1, 5}, {-2, 9, -1, 6}, { 5, 6, 9, -9}, { -6, 1, 1, 1} }Out −Minimum sum submatrix in a given 2D array is: -9Explanation −we are given a 2-D array of size 4x4 i.e. 4 rows and 4 columns. Now, we will find out the sub-matrix from the given matrix such ... Read More
819 Views
We are given a tree data structure with ‘n’ number of nodes. The given tree will have a root node and respective children which can be any number and further child can have any number of children. The task is to find the minimum number of iterations required by a root node of a tree to pass the information to all nodes in a tree. At a time, a node can pass information to one of its children and further one of its children can pass information to one of its children and meanwhile root node can pass information to ... Read More