 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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 813 of 2650
 
 
			
			211 Views
Suppose we are given a matrix that contains n rows and m columns. We have to find out the largest number of consecutive elements in the matrix where the gcd of the elements is greater than 1. The consecutive elements can either lie horizontally or vertically in the matrix.So, if the input is like37912594678510and m = 4, n = 3; then the output will be 3.The fourth column of the given matrix is 12, 6, 10. The gcd of the elements of this column is 2. As there are three elements, the answer is 3.To solve this, we will follow ... Read More
 
 
			
			158 Views
To create an open time interval, use the pandas.Interval() and set the closed parameter to neither. To check for existence of both the endpoints, use the in property.At first, import the required libraries −import pandas as pdOpen interval set using the "closed" parameter with value "neither". An open interval (in mathematics denoted by square brackets) does not contains its endpoints, # i.e. the open interval [0, 5] is characterized by the conditions 0 < x < 5:interval = pd.Interval(left=0, right=20, closed='neither')Display the intervalprint("Interval...", interval)Check for the existence of an element in an Interval. This shows that closed = neither does ... Read More
 
 
			
			342 Views
To create a closed time interval, use the pandas.Interval() and set the closed parameter. To check for existence of both the endpoints, use the in property.At first, import the required libraries −import pandas as pdClosed interval set using the "closed" parameter with value "both". A closed interval (in mathematics denoted by square brackets) contains its endpoints, # i.e. the closed interval [0, 5] is characterized by the conditions 0
 
 
			
			2K+ Views
To check if an element belongs to an Interval, use the in property. At first, import the required libraries −import pandas as pdCreate a time intervalinterval = pd.Interval(left=0, right=10) Display the intervalprint("Interval...", interval)Check for the existence of an element in an Intervalprint("The specific element exists in the Interval? = ", 6 in interval) ExampleFollowing is the code import pandas as pd # Create a time interval interval = pd.Interval(left=0, right=10) # display the interval print("Interval...", interval) # display the interval length print("Interval length...", interval.length) # check for the existence of an element in an Interval print("The ... Read More
 
 
			
			4K+ Views
To create a time interval and use Timestamps as the bounds, use pandas.Interval and set timestamp within it using pandas.Timestamp.At first, import the required libraries −import pandas as pdUse Timestamps as the bounds to create a time interval. Closed interval set using the "closed" parameter with value "left"interval = pd.Interval(pd.Timestamp('2020-01-01 00:00:00'), pd.Timestamp('2021-01-01 00:00:00'), closed='left')Above, we have used Timestamps as the bounds. Display the interval print("Interval...", interval)ExampleFollowing is the code import pandas as pd # Use Timestamps as the bounds to create a time interval # closed interval set using the "closed" parameter with value "left" interval = pd.Interval(pd.Timestamp('2020-01-01 00:00:00'), ... Read More
 
 
			
			121 Views
To return the Period object as a timestamp with yearly frequency, use the period.to_timestamp() method and set the freq parameter as ‘Y’.At first, import the required libraries −import pandas as pdThe pandas.Period represents a period of time. Creating a Period objectperiod = pd.Period(freq="S", year = 2021, month = 9, day = 18, hour = 17, minute = 20, second = 45)Display the Period object print("Period...", period)Return the Timestamp representation of the Period object. We have set the frequency using the "freq" parameter. The frequency is set as 'Y' i.e. yearlyprint("Period to Timestamp with yearly (year-end) frequency...", period.to_timestamp(freq='Y')) ExampleFollowing is the ... Read More
 
 
			
			204 Views
To return the Period object as a timestamp with daily frequency, use the period.to_timestamp() method and set the freq parameter as ‘D’.At first, import the required libraries −import pandas as pdThe pandas.Period represents a period of time. Creating a Period object period = pd.Period(freq="S", year = 2021, month = 11, day = 26, hour = 11, minute = 45, second = 55)Display the Period objectprint("Period...", period) Return the Timestamp representation of the Period object. We have set the frequency using the "freq" parameter. The frequency is set as 'D' i.e. dailyprint("Period to Timestamp with daily frequency...", period.to_timestamp(freq='D'))ExampleFollowing is the code ... Read More
 
 
			
			106 Views
To return the Period object as a timestamp with monthly frequency, use the period.to_timestamp() method and set the freq parameter as ‘T’.At first, import the required libraries −import pandas as pdThe pandas.Period represents a period of time. Creating a Period objectperiod = pd.Period(freq="S", year = 2021, month = 11, day = 26, hour = 11, minute = 45, second = 55) Display the Period object print("Period...", period)Return the Timestamp representation of the Period object. We have set the frequency using the "freq" parameter. The frequency is set as 'T' i.e. minutelyprint("Period to Timestamp with minutely frequency...", period.to_timestamp(freq='T')) ExampleFollowing is the ... Read More
 
 
			
			290 Views
To return the Period object as a timestamp with monthly frequency, use the period.to_timestamp() method and set the freq parameter as ‘M’.At first, import the required libraries −import pandas as pdThe pandas.Period represents a period of time. Creating a Period objectperiod = pd.Period(freq="S", year = 2021, month = 9, day = 18, hour = 17, minute = 20, second = 45) Display the Period objectprint("Period...", period)Return the Timestamp representation of the Period object. We have set the frequency using the "freq" parameter. The frequency is set as 'M' i.e. monthlyprint("Period to Timestamp with monthly (month-end) frequency...", period.to_timestamp(freq='M'))ExampleFollowing is the code ... Read More
 
 
			
			135 Views
To return the Timestamp representation of the Period object, use the period.to_timestamp() method.At first, import the required libraries −import pandas as pdThe pandas.Period represents a period of time. Creating a Period objectperiod = pd.Period(freq="S", year = 2021, month = 9, day = 18, hour = 17, minute = 20, second = 45)Display the Period objectprint("Period...", period) Return the Timestamp representation of the Period object. We have set the frequency using the "freq" parameterprint("Period to Timestamp...", period.to_timestamp(freq='T'))ExampleFollowing is the code import pandas as pd # The pandas.Period represents a period of time # Creating a Period object period = pd.Period(freq="S", ... Read More