Informatics Practices
How do you create quantiles and quartiles in Python Pandas ?
Python Pandas
2 Likes
Answer
In Python pandas, we can create quantiles and quartiles using the quantile()
method.
The statement to create quartiles is df.quantile(q = 0.25)
.
Answered By
1 Like
Related Questions
What do quantile and var() functions do ?
What is a quartile ? How is it different from quantile ?
Assume that required libraries (Pandas and Numpy) are imported and DataFrame ndf has been created as shown in solved problem 16. Predict the output produced by following code fragment :
print(ndf[ndf["age"] > 30]) print(ndf.head(2)) print(ndf.tail(3))
The following DataFrame
ndf
is from solved problem 16 :Name Sex Position City age Projects Budget 0 Rabina F Manager Bangalore 30 13 48 1 Evan M Programer New Delhi 27 17 13 2 Jia F Manager Chennai 32 16 32 3 Lalit M Manager Mumbai 40 20 21 4 Jaspreet M Programmer Chennai 28 21 17 5 Suji F Programmer Bangalore 32 14 10
Given the two DataFrames as :
>>> dfc1 - - 0 1 0 2 a 1 3 b 2 4 c
>>> dfc2 - - 0 1 2 0 2 3 4 2 p q r
Why are following statements giving errors ?
(a) print(dfc1 + dfc2)
(b) print(dfc1.sub(dfc2))
(c) print(dfc1 * dfc2)