Group Group Group Group Group Group Group Group Group

Chapter 4 page 128

#1

That’s what it was displayed after typing and pressing Shift-Enter.

?data.tail(3)

The documentation was not shown.

#2

Try it without the (3), so just ?data.tail

#3

I pressed Shift-Enter with the same result.

By pressing Shift-Tab-Tab does not shown the documentation either.

#4

Hey @praxon48,

The numbers next to your output — In[1] and In[2] — show that these are the 1st and 2nd cells that you ran, even though the cell above them claims it was the 14th cell you ran. That means you most likely restarted the kernel (perhaps you relaunched the notebook?) and then went straight to these cells to try running them. But that won’t work because you haven’t actually created the data object yet.

Jupiter notebooks can be misleading because they save any displayed output in the file, however, the variables are actually only stored in memory. So when you restart a notebook, it will no longer have anything in memory, even though the file still appears to include all the output.

I recommend you go to the Kernel menu and choose Restart — or even Restart and Clear Output to get rid of all the old outputs — and then re-run every cell starting at the beginning of the notebook.

I hope this helps!

-Chris

#5

I follow your advice and this is what I got:

SHIFT-TAB-TAB is working, but as you can see the code in cell three does not when using the question mark ?data.tail(3) and SHIFT-ENTER.

#6

Hmm. Sorry, then I honestly have no idea why that’s happening. It works when I run it, but I know hearing “it works on my machine” isn’t very helpful. :frowning_face:

I wonder, does the ? trick work with anything else? For example, does running a cell containing

?list

show any docstring or does it report an error, too?

#7

It works with the command. ?list but not with the other one. I can continue without that trick.

Thank You!!!

#8

For me, ?data.tail(3) also doesn’t work but ?data.tail does. This might be a versioning thing where it may work with some version of Jupyter/Python but not with others.

When I do conda list it shows:

jupyter_client            5.2.4                    py36_0  
jupyter_core              4.4.0                    py36_0  
notebook                  5.7.6                    py36_0
pandas                    0.24.2           py36h0a44026_0  

@clapollo @praxon48 What does this show for you?

#9

jupyter_client 5.2.4 py37_0
jupyter_core 4.4.0 py37_0
notebook 5.7.8 py37_0
pandas 0.24.2 py37h0a44026_0

#10

@hollance: I tried it on two setups:

For this one, it only works with ?data.tail

jupyter_client            5.2.4                    py36_0
jupyter_core              4.4.0                    py36_0
notebook                  5.7.4                    py36_0 
pandas                    0.24.2           py36he6710b0_0

For this one, it works both as ?data.tail, ?data.tail() and ?data.tail(3):

jupyter_client            5.1.0                    py27_0
jupyter_core              4.3.0                    py27_0
notebook                  5.0.0                    py27_0
pandas                    0.24.2           py27h0a44026_0

Notice I used two very different environments and the ? worked differently in each. I see @praxon48 is using Python 3.7 and a version of notebook newer than either of us. My guess is that’s what’s causing the issue.

#11

The ebook instructs to download Python 3.7 and the version of Python at the Anaconda’s download page is Python 3.7.

What version of Python should I install? Should I download a specificities version of Python directly from Python.org?
What version of python are you using, I would like to download that version to be compatible with the exercises in the ebook.

I’m going to reinstall my system to do chapter 4 again, if you can provide the terminal commands or some instruction to have the correct software versions installed to follow with the book will be really helpful.

Thank you!

#12

Installed Python 3.6 and it works with ?data.tail only.

#13

The download for Anaconda is for Python 3.7, but it still allows you to install Python 3.6. The book has been written with 3.6 in mind, and some of the packages (such as coremltools, turicreate, etc) may not work with 3.7 yet (or didn’t when we wrote the book).

It’s a bit confusing that you have to download Anacoda for Python 3.7 and then install Python 3.6 into your environment, but that’s the preferred approach.

However, if you don’t want to use Anaconda, you can also use Python 3.6 (from homebrew, for example) and install all the packages using pip. But it’s really easy to make a mess of your packages, which is why we recommend Anaconda.

#14

I followed the the instructions in the book very carefully many times with the same results that I had posted in the last 3 days. The good thing is that I’m getting good at creating and deleting environments. In fact I have burning the midnight oil and improve my understanding of machine learning by trouble shooting and searching more info with google. So far so good. Before reading the ebook it was a mystery Machine Learning and all its tools. That thought has change. I’m learning.

Thank you!