首页 > 解决方案 > Fill in data elided with "..." in output from pandas.DataFrame.corr()

问题描述

When I run a command in Python like

import pandas as pd
dt = pd.read_csv("C:/Code/StudentsPerformance.csv")
dt.corr()

I get some of the data in the results

                            t_gender      ...       writingscore
t_gender                    1.000000      ...           0.301225
t_race                      0.001502      ...           0.165691
t_parentallevelofeducation -0.028383      ...          -0.192338
t_lunch                     0.021372      ...          -0.245769
t_testpreparationcourse          NaN      ...                NaN
mathscore                  -0.167982      ...           0.802642
readingscore                0.244313      ...           0.954598
writingscore                0.301225      ...           1.000000

[8 rows x 8 columns]

How can I get the all result data (the things that should be in the "..." ) in the results??

Python is showing only some of the data in the results..

Instead of showing

t_gender t_race t_parentallevelofeducation t_lunch t_testpreparationcourse mathscore readingscore writingscore

in the columns it only shows

t_gender      ...       writingscore

I want to display all columns

标签: pythonpandas

解决方案


Change the printing options:

import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

推荐阅读