Arnab Chakraborty has Published 4452 Articles

Python Pandas - Convert given Timestamp to Period with quarterly frequency

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Oct-2021 07:00:22

514 Views

To convert given Timestamp to Period, use the timestamp.to_period() method. Within that, set the frequency using the freq parameter. For quarterly frequency, set freq as Q.At first, import the required libraries −import pandas as pdCreate the timestamp object in Pandastimestamp = pd.Timestamp(2021, 9, 18, 11, 50, 20, 33) Convert timestamp ... Read More

Python Pandas - Convert given Timestamp to Period with monthly frequency

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Oct-2021 06:57:16

426 Views

To convert given Timestamp to Period, use the timestamp.to_period() method. Within that, set the frequency using the freq parameter. For monthly frequency, set freq as M.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandastimestamp = pd.Timestamp(2021, 9, 18, 11, 50, 20, 33) Convert timestamp ... Read More

Python Pandas - Convert given Timestamp to Period with weekly frequency

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Oct-2021 06:51:05

278 Views

To convert given Timestamp to Period, use the timestamp.to_period() method. Within that, set the frequency using the freq parameter. For weekly frequency, set freq as W.At first, import the required libraries −import pandas as pdCreate the timestamp object in Pandastimestamp = pd.Timestamp(2021, 9, 18, 11, 50, 20, 33) Convert timestamp ... Read More

Python Pandas - Convert given Timestamp to Period with minutely frequency

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Oct-2021 06:46:27

121 Views

To convert given Timestamp to Period, use the timestamp.to_period() method. Within that, set the frequency using the freq parameter. For minutely frequency, set freq as T.At first, import the required libraries −import pandas as pdCreate a timestamp objecttimestamp = pd.Timestamp(2021, 9, 6, 11, 50, 20, 33) Convert timestamp to Period. ... Read More

Python Pandas - Convert given Timestamp to Period

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Oct-2021 06:36:53

680 Views

To convert given Timestamp to Period, use the timestamp.to_period() method. Within that, set the frequency using the freq parameter.At first, import the required libraries −import pandas as pdSet the timestamp object in Pandastimestamp = pd.Timestamp('2021-09-14T15:12:34.261811624')Now, convert timestamp to Period. We have set the frequency as Month using the "freq" parameter ... Read More

Program to find ex in an efficient way in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 14:38:19

89 Views

Suppose we have a number n. We have to find $e^{x}$ efficiently, without using library functions. The formula for $e^{x}$ is like$$e^{x} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + ...$$So, if the input is like x = 5, then the output will be 148.4131 because e^x = 1 ... Read More

Program to count number of common divisors of two numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 14:04:06

521 Views

Suppose we have two numbers a and b. We have to find how many positive integers are there, that are divisors to both a and b.So, if the input is like a = 288 b = 240, then the output will be 10 because the common divisors are [1, 2, ... Read More

C++ program to demonstrate function of macros

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 13:48:40

335 Views

Suppose we are given a integer array that contains several integer values. We have to find out the difference between the smallest value and the largest value in the array. To solve this problem, we have to use macros. The inputs are taken from stdin, and the result is printed ... Read More

Program to generate Pascal's triangle in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 13:28:50

11K+ Views

Suppose we have a number n. We have to generate Pascal's triangle up to n lines. The Pascal's triangle will be look like this −The property of Pascal's triangle is the sum of each adjacent two numbers of previous row is the value of the number which is placed just ... Read More

Program to check a number is palindrome or not without help of a string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:33:02

7K+ Views

Suppose we have a non-negative integer called num, we have to check whether it is a palindrome or not. We have to solve it without using stringsSo, if the input is like num = 25352, then the output will be TrueTo solve this, we will follow these steps −a := ... Read More

Advertisements