[Tutor] Jupyternotebook set up

Olsen, Avalow Y Yuanyuan.A.Olsen at HealthPartners.Com
Mon Jan 27 23:01:47 EST 2020


Thanks, Gary!
You are right. Pandas has its own built-in options for display.  The following code works:

pd.options.display.max_rows = None
pd.options.display.min_rows = None  #  this line is a must. Otherwise it would still only show head and tail.

Really appreciate it!  Thank you!
Ava
From: Gary LaRose [mailto:garylarose at outlook.com]
Sent: Monday, January 27, 2020 8:41 PM
To: Olsen, Avalow Y <Yuanyuan.A.Olsen at HealthPartners.Com>
Cc: tutor at python.org
Subject: [EXTERNAL]Re: [Tutor] Jupyternotebook set up


External Email: Don't click links or attachments unless you trust the email.
It appears you are printing value counts from a pandas dataframe column (series)

Check this stackoverflow post

https://stackoverflow.com/questions/19124601/pretty-print-an-entire-pandas-series-dataframe#30691921

Try option_context ( from above post )


with pd.option_context('display.max_rows', None):  # more options can be specified also

    print(cars.horsepower.value_counts())
Or try pd.option_context as above with:
print(cars[‘horsepower’].value_counts())



On Jan 27, 2020, at 8:11 PM, Olsen, Avalow Y <Yuanyuan.A.Olsen at healthpartners.com<mailto:Yuanyuan.A.Olsen at healthpartners.com>> wrote:
Hi All,

I am using Jupyter Notebook for Python programing through Anaconda.

Anaconda Navigator version = 1.9.7

Jupyter Notebook version= 6.0.2

When running the following code, presumably there are 6 entries with the value "Not available" in the frequency.  Since the output is a long list, the "Not available" value is omitted in the outcome pane by .. as shown below.

              cars.horsepower.value_counts()

                  150.0    22
      90.0     19
      110.0    19
      100.0    16
      88.0     14
               ..
      230.0     1
      107.0     1
      158.0     1
      137.0     1
      167.0     1
      Name: horsepower, Length: 85, dtype: int64

Here is the proof that "Not available " exists in the horsepower variable
cars.horsepower.value_counts().loc["Not available "]

      6

There are 6 entries with the value "Not available"


My question is how to setup Jupyter Notebook in order to let the whole list of values be shown like below?


                  150.0    22
      90.0     19
      110.0    19
      100.0    16
      88.0     14
      105.0    12
      95.0     10
      85.0      9
      70.0      8
      145.0     7
      Not available 6
      84.0      5
               ..
      230.0     1
      107.0     1
      158.0     1
      137.0     1
      167.0     1



Thank you in advance!
Ava



________________________________

This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the individual responsible for delivering the e-mail to the intended recipient, please be advised that you have received this e-mail in error and that any use, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited.

If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. Disclaimer R001.0
_______________________________________________
Tutor maillist  -  Tutor at python.org<mailto:Tutor at python.org>
To unsubscribe or change subscription options:
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Ftutor&data=02%7C01%7C%7C87478238f7294eaaf99208d7a38efe51%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637157706850698976&sdata=05RKoT8ZvgE%2B07PPbFSjlytANDEydgBYt6qPmLIRpGw%3D&reserved=0


More information about the Tutor mailing list