Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandas .describe() only returning 4 statistics on int dataframe (count, unique, top, freq)... no min, max, etc

Tags:

python

pandas

Why could this be? My data seems pretty simple and straightforward, it's a 1 column dataframe of ints, but .describe only returns count, unique, top, freq... not max, min, and other expected outputs.

(Note .describe() functionality is as expected in other projects/datasets)

like image 607
user1318135 Avatar asked Jul 18 '16 09:07

user1318135


People also ask

What does Pandas describe () method return?

Pandas DataFrame describe() Method The describe() method returns description of the data in the DataFrame. If the DataFrame contains numerical data, the description contains these information for each column: count - The number of not-empty values.

How do you count unique frequency in Pandas?

How do you Count the Number of Occurrences in a data frame? To count the number of occurrences in e.g. a column in a dataframe you can use Pandas value_counts() method. For example, if you type df['condition']. value_counts() you will get the frequency of each unique value in the column “condition”.

What does describe () do in Python?

The describe() method computes and displays summary statistics for a Python dataframe. (It also operates on dataframe columns and Pandas series objects.)

How do you count the number of occurrences in Pandas DataFrame?

Using the size() or count() method with pandas. DataFrame. groupby() will generate the count of a number of occurrences of data present in a particular column of the dataframe.


1 Answers

It seems pandas doesn't recognize your data as int.

Try to do this explicitly:

print(df.astype(int).describe())
like image 186
frist Avatar answered Sep 18 '22 10:09

frist