I cannot list the unique values of the dataframe

Asked

Viewed 507 times

1

I have a dataframe with 1 million lines, I know that to list the unique values would be df['Col'].unique(), but I can’t see them all, because this method shows only the first and last lines, leaving hidden the middle lines of the dataframe. How could you see all these values?

1 answer

1


Hiding the middle of the dataframes is a standard Pandas configuration, since most of the time it doesn’t make sense to see dates "in the middle" - seeing the beginning and the end can have an idea of how the frame is. If one wants to see a set of specific lines, select those lines with index notation.

The final results will be consumed on the screen - so, after a calculation, the dataframe is saved to a file in CSV/Excel/Database where the data will be consumed.

Well, all this to explain why Pandas does it by default. Of course many times we may want to see all the data on the screen, and in some cases, "consume" the data directly from there -

Setting how many lines are shown in Pandas is in the attribute pd.options.display.max_rows - just increase that number that the amount of linahs displayed from a datframe without clipping changes.

pd.options.display.max_rows = 1000000

would display even your original, full dataframe. (Of course it would take you a half hour just to roll it down)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.