0

I'm analyzing a data-frame and want to check more detailed lists
but even though I searched some solutions from google,
I don't understand why the result is not changed. what is the problem??

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

# Import data
df = df = pd.read_csv(r"C:\Users\Administrator\Desktop\medical.txt")

pd.set_option("display.max_rows", 50)
pd.set_option('display.max_columns', 15)

print(df)


          id    age  gender  height  weight  ap_hi  ap_lo  cholesterol  gluc  
0          0  18393       2     168    62.0    110     80            1     1   
1          1  20228       1     156    85.0    140     90            3     1   
2          2  18857       1     165    64.0    130     70            3     1   
3          3  17623       2     169    82.0    150    100            1     1   
4          4  17474       1     156    56.0    100     60            1     1   
     ...    ...     ...     ...     ...    ...    ...          ...   ...   
69995  99993  19240       2     168    76.0    120     80            1     1   
69996  99995  22601       1     158   126.0    140     90            2     2   
69997  99996  19066       2     183   105.0    180     90            3     1   
69998  99998  22431       1     163    72.0    135     80            1     2   
69999  99999  20540       1     170    72.0    120     80            2     1    
Jinsu
  • 19
  • 6
  • 1
    what has not changed? what is your question? can you edit the question to provide a reproducible example so users can copy the code and recreate the issue you have. Please have a look at [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – anky Jan 06 '21 at 07:57
  • 1
    you can give df.head(50) if you want 50 rows. What are you specifically looking for? – Joe Ferndz Jan 06 '21 at 08:01
  • I mean, I just want to see a few hundreds rows in the data-frame if I set display option as 200 from (0~100) to (69900~69999) – Jinsu Jan 06 '21 at 08:29

2 Answers2

1

Look at https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html at "Frequently used options" chapter.

You can see that if the "max_rows" is lower than the total number of rows in your dataframe then it is displayed like your results.

Below a copy past of the interesting part in the link that I gave you:

enter image description here

thibaultbl
  • 886
  • 1
  • 10
  • 20
0

if there are a way to display enough columns

pd.set_option('display.width',1000)
or
pd.set_option('display.width',None)

but to rows may be you only use

df.head(50) 
or
df.tail(50)

or follows to DisplayAll

pd.set_option("display.max_rows", None)

Why set that is useless:

The second parameter is not the maximum number of rows that can be viewed, but an internal template parameter

  • code as follows:
set_option = CallableDynamicDoc(_set_option, _set_option_tmpl)

CallableDynamicDoc:

class CallableDynamicDoc:
    def __init__(self, func, doc_tmpl):
        self.__doc_tmpl__ = doc_tmpl
        self.__func__ = func
 
    def __call__(self, *args, **kwds):
        return self.__func__(*args, **kwds)
 
    @property
    def __doc__(self):
        opts_desc = _describe_option("all", _print_desc=False)
        opts_list = pp_options_list(list(_registered_options.keys()))
        return self.__doc_tmpl__.format(opts_desc=opts_desc, opts_list=opts_list)
Para
  • 1,299
  • 4
  • 11