Udemy course...small complaint

I like the instructor...but! I notice in teaching a subject he will often place multiple commands in one cell. For example at around 2:18 in lecture "82. Filter A DataFrame with the query method" he starts talking about the df.query() method but he continues adding two more df.query() in the same cell. My question was...

In your this video you stack 3 queries in the same cell. I assume Jupyter Notebooks is only executing the last query, because the other 2 don't display. True? However throughout the course you stack other commands together that clearly get executed together. Would you elaborate?

He responded (I added bolding)

Jupyter Notebook will execute all the content in the cell when it is run .

But it will only visually output the final expression in a cell .

So if we execute a cell like this:

```

1 + 1

2 + 2

3 + 3

```

6 will be output. The other calculations will still take place (they just won't be visually output).

I wanted to say (but I didn't)...

OKā€¦thanks. So for teaching on small datasets it's fine. But it's probably better to run some commands in different cells especially when working with large data sets. You mentioned pandas working with tens of millions of records early in the course. If you do 3 df.query() in the same cell then the 1st 2 are needlessly using computer resources. For example I tried something you taught earlier in the course, on a large dataset and it was noticeably much slower than other operations I tried on the same dataset, it may have been pd.to_datetime()?


Like I said for teaching on small datasets it's fine . My problem, and it's a small one, is he will frequently stack commands like this, in one cell. However I don't ever remember him saying it's bad practice. Either put a command in a new cell or delete or comment out the previous commands. Now if an assignment was made to a variable for those queries, and in this case it wasn't, then perhaps the intent was to use those queries later for further analysis!

2020-07-18 11:40:47
Index