简体   繁体   中英

How to print all rows/data from csv file with Pandas in Python?

Problem

I have a CSV file which has 100 rows. I want to print them all with pandas module. But It only printing 10 rows. How can I print all of them?

Code

from pandas import *

cvs=read_csv('sample.csv')

print(cvs)

Output which I get

    Serial Number                   Company Name  ...         Description Leave
0   9788189999599                 TALES OF SHIVA  ...                mark     0
1   9780099578079      1Q84 THE COMPLETE TRILOGY  ...                Mark     0
2   9780198082897                       MY KUMAN  ...                Mark     0
3   9780007880331        THE GOD OF SMAAL THINGS  ...  4TH HARPER COLLINS     2
4   9780545060455               THE BLACK CIRCLE  ...  4TH HARPER COLLINS     0
..            ...                            ...  ...                 ...   ...
94  9788184821536  MORE STORIES FROM THE JATAKAS  ...                 ACK     0
95  9788184821543           MORE TALES OF BIRBAL  ...                 ACK     0
96  9788184821550         TALES FROM THE JATAKAS  ...                 ACK     0
97  9788184821567               RAMarkS OF MEWAR  ...                 ACK     0
98  9788184821574       THE SONS OF THE PANDAVAS  ...                 ACK     0

[99 rows x 5 columns]
[Finished in 5.6s]

Set display.max_rows:

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

You can try this one

from pandas import *

cvs=read_csv('sample.csv')
pandas.set_option('display.max_rows', csv.shape[0]+1)

print(cvs)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM