More Than Five
More Than Five

Reputation: 10429

Not seeing the full column, in Pandas Dataframe

In my dataframe, I have a one column which has a very large set with a lot of information.

When I do:

df.head()

It crops the column data so I can't see it all. Any ideas how stop the cropping and have scrollbar instead?

Thanks

Upvotes: 0

Views: 1519

Answers (3)

Dr G.
Dr G.

Reputation: 1332

An easy solution is to just set display.max_colwidth to -1 like:

pd.set_option('display.max_colwidth', -1)

Upvotes: 1

More Than Five
More Than Five

Reputation: 10429

One to do this:

pd.set_option('max_colwidth', 2000)

Upvotes: 0

data_henrik
data_henrik

Reputation: 17176

The command df.head() prints the first few rows of a dataframe, df.tail() the last rows. It is 5 by default, but you could say, e.g., df.head(20) to get 20 rows.

df should return the entire data frame and with df[n:m] you can return the rows from n to m, just df[:5] is the same as the head function.

See here for more on data frames.

Upvotes: 0

Related Questions