-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add materials for Numpy Tutorial article. #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hmm, any chance you're on a different version of black locally than what we use on the repo? Here's the requirements file we're using on CI: https://github.com/realpython/materials/blob/master/requirements.txt#L1-L2 |
|
@rpalo Yeah, it's a version issue. When I used the latest In this case, I'd argue that it makes sense to keep Ryan's original formatting. @dbader Is there a way to suppress a rule in |
numpy-tutorial/README.md
Outdated
| # Code Materials for the Numpy Tutorial | ||
|
|
||
| These are code resources for the Numpy Tutorial article by @rpalo. No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔗 Link
Can you please include a link to the original article? Ideally, the link should spell the title:
| # Code Materials for the Numpy Tutorial | |
| These are code resources for the Numpy Tutorial article by @rpalo. | |
| # NumPy Tutorial: First Steps in Data Science | |
| This folder contains the sample code for the [NumPy Tutorial](https://realpython.com/numpy-tutorial/) by @rpalo. |
numpy-tutorial/README.md
Outdated
| # Code Materials for the Numpy Tutorial | ||
|
|
||
| These are code resources for the Numpy Tutorial article by @rpalo. No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤝 Handholding
I would also recommend showing the reader how to use those examples. For instance, show a command that installs NumPy and Matplotlib, which then could be quickly copied-and-pasted in the terminal:
$ python -m pip install numpy matplotlib
Better yet, add a requirements.txt file with all the dependencies with tested versions, and show how to use it:
$ python -m pip install -r requirements.txt
Show how to run the individual scripts and their outputs:
$ python normal.py
[-0.34057664 0.03159261 -0.46815197 -0.30809633 -0.37834691]
9534
10000
0.9534
numpy-tutorial/image_mod.py
Outdated
| import numpy as np | ||
| import matplotlib.image as mpimg | ||
|
|
||
| img = mpimg.imread("kitten.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| img = mpimg.imread("kitten.png") | |
| img = mpimg.imread("kitty.jpg") |
numpy-tutorial/curve_grades.py
Outdated
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 Style Tip
Use consistent code formatting. Some of your files follow PEP 8 with respect to the number of blank lines, while others don't, for example.
numpy-tutorial/image_mod.py
Outdated
| print(type(img)) | ||
| print(img.shape) | ||
|
|
||
| # => numpy.ndarray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👩💻 Technical Recommendation
Since you're showing output in most of your Python source files, maybe it would make sense to replace them with Jupyter Notebooks (.ipynb files)? They allow to save the expected output with them. What do you think?
(You can take a look at build-a-web-scraper/ folder, which comes with a few of those notebooks.)
|
FYI I bumped flake8 and black on |
|
Woohoo! Thanks. I'm planning on resolving all of the other requests (along with the requests on the article draft) today or tomorrow. Thanks again 😄 |
Co-authored-by: Bartosz Zaczyński <bartosz.zaczynski@gmail.com>
bzaczynski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpalo I just noticed a typo in the Maclauren name. It's actually Maclaurin with an "i" after Colin Maclaurin. Please update the relevant notebook as well as the file name. Thanks!
|
lgtm |
|
Note, no changes to the code or anywhere else in the repo. Just re-running the image_mod.ipynb with higher res kitty images to match the images I'm using in the article to appease the preflight. |
Add materials for Numpy Tutorial article.

Where to put new files:
my-awesome-articleHow to merge your changes: