TransWikia.com

How do you see the element of a csv table with many columns (>30) which the names of its columns is more than 10 character in pandas?

Data Science Asked on May 4, 2021

How do you see in pandas the element of a csv table with many columns (>25) which the names of its columns is more than 10 character?
I have 5000 rows and 32 columns and the label of some columns are more than 10 characters.
How I ca see them and work with different columns?

Excel does not work! All of the items are sloppy

Access is OK but could not detect the long labels of items!

What is your solution for it?

One Answer

I dont know which compiler you are using but mine is jupyter.

You can make wider notebook by:

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

By doing that you can display more columns with df.head(). If you cant display still ("..." between columns), you can use iloc. For you data I used df.iloc[:5,:15] and df.iloc[:5,15:].

Also which is a better solution you can change pandas display options by:

pd.set_option('display.max_columns', 500)

Here is the screenshot of my notebook:

enter image description here

Correct answer by Ilker Kurtulus on May 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP