Search code examples
pythonpandasdataframenumpyanalytics

How to assign to a variable the outputs of the method "describe"?


good morning!

Could you help me, please, teaching me how to assign to a variable the outputs of the method "describe"?

enter image description here

Thanks and have a great day!


Solution

  • The 25% and 50% are quantiles so you can simply use the pandas quantile function to get those values.

    For all the information you see in describe output, you have functions in pandas.DataFrame that you can work with, e.g.:

    count -> pandas.DataFrame.count
    mean -> pandas.DataFrame.mean
    std -> pandas.DataFrame.std
    min -> pandas.DataFrame.min
    25%, 50%, 75% or any other quantile -> pandas.DataFrame.quantile
    max -> pandas.DataFrame.max