The command below shows some details about the dataframe.
df.describe()
It gives details about count, mean, std, min, 25%, ...
Is there any way to get the count of rows in a dataframe at 75% or 25%?
Thanks.
The command below shows some details about the dataframe.
df.describe()
It gives details about count, mean, std, min, 25%, ...
Is there any way to get the count of rows in a dataframe at 75% or 25%?
Thanks.
pandas.Series.quantile
to determine the value for the given quantile of the selected column.
.quantile
has the benefit of being able to specify any quantile value (e.g. 30%
).describe()
is limited to [25%, 50%, 75%]
, and it performs unnecessary aggregations..ge
and .le
.ge
is >=
.le
is <=
.eq
is ==
quartile_25.count()
or len(quartile_25)
, to get determine how many values meet the criteria.col
should be some column name as a string
quartile_75 = df[df[col].ge(df[col].quantile(q=.75))]
quartile_25 = df[df[col].le(df[col].quantile(q=.25))]
max_ = df[df[col].eq(df[col].max())]