0
$\begingroup$

I want to see entire 5788 rows and 7 columns of my CSV data. I used below code and it is giving little data by stating [5788 rows x 7 columns] but showing only 10 rows and 5 columns in python prompt. How to get display of entire rows and column there?

import pandas as pd
df = pd.read_csv("BusinessData.csv")
print (df)
$\endgroup$
  • $\begingroup$ I frequently use the command less in the bash CLI. Very quick for any size data. $\endgroup$ – oaxacamatt May 13 at 14:34
2
$\begingroup$

pandas has a max rows setting - https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html

Though perhaps looking at a 5,000+ row csv in an editor, or a spreadsheet or some IDEs have a csv editor would be more useful.

| improve this answer | |
$\endgroup$
2
$\begingroup$

You can edit the maximum number of rows displayed by PANDAS with the 'display.max_rows' option. If you want it to show all your rows, you can do:

    import pandas as pd
    df = pd.read_csv("BusinessData.csv")

    pd.set_option('display.max_rows', df.shape[0])
    print(df)
| improve this answer | |
$\endgroup$
1
$\begingroup$

You can print all your rows by iterating over them and printing.

import pandas as pd
df = pd.read_csv("BusinessData.csv")

print(df.columns)
for index, row in df.iterrows():
    print(index, row.tolist())
| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ It works ! Thanks Bruno. $\endgroup$ – ADS KUL May 13 at 8:10
0
$\begingroup$

Following this article How to show all columns/rows of a Pandas Dataframe?. I normally use the following commands.

# Display all columns
pd.set_option('display.max_columns', None)

#Display all rows
pd.set_option('display.max_rows', None)

#Display all elements in each col
pd.set_option('max_colwidth', None)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.