Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NiuZhixiao committed Oct 17, 2023
2 parents d86a2ec + d9a026e commit 29ed998
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/binder.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# used to prebuild docker caching on mybinder.org to accelerate Binder launch
name: Build Notebook Container
on: [push] # You may want to trigger this Action on other things than a push.
on:
push:
branches:
- master # only trigger GitHub action when master branch has push
jobs:
build:
runs-on: ubuntu-latest
Expand Down
Binary file modified assets/images/numpy_axis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/numpy_broadcast1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/numpy_broadcast1-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/numpy_broadcast1.png
Binary file not shown.
3 changes: 2 additions & 1 deletion chapters/data-analytics/numpy-basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,8 @@
"id": "c65a3f1b-9794-4784-ad93-b86357c9ed86",
"metadata": {},
"source": [
"<img src=\"../../assets/images/numpy_broadcast1.png\" width=\"600\" align=\"center\"/>\n",
"<img src=\"../../assets/images/numpy_broadcast1-1.png\" width=\"600\" align=\"center\"/>\n",
"<img src=\"../../assets/images/numpy_broadcast1-2.png\" width=\"600\" align=\"center\"/>\n",
"\n",
"We could see that when shapes of both arrays are *compatible*, NumPy would automatically stretch (replicating) arrays as above so that arithmetic calculations can be directly applied. **But how can we know array shapes are compatible? 🤔**\n",
"\n",
Expand Down
16 changes: 8 additions & 8 deletions chapters/data-analytics/python-basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@
}
],
"source": [
"h = 'hello' # String literals can use single quotes\n",
"w = \"world\" # or double quotes\n",
"h = 'hello' # String literals can use single quotes\n",
"w = \"world\" # or double quotes\n",
"print(h, len(h)) # Built-in function len() return the length of elements"
]
},
Expand Down Expand Up @@ -411,7 +411,7 @@
}
],
"source": [
"hw1 = '{} {}! {}'.format(h, w, 2023) # String formatting by sequence\n",
"hw1 = '{} {}! {}'.format(h, w, 2023) # String formatting by sequence\n",
"print(hw1)\n",
"hw2 = '{1} {0}! {2} {2:.2f}'.format(h, w, 2023) # String formatting by specifying orders and formats\n",
"print(hw2)"
Expand Down Expand Up @@ -460,7 +460,7 @@
"id": "06cayXLtL9fi"
},
"source": [
"You can find more information about Python basic data types in the official [documantion](https://docs.python.org/3.7/library/stdtypes.html), such as a list of [all string methods](https://docs.python.org/3.7/library/stdtypes.html#string-methods)."
"You can find more information about Python basic data types in the official [documantion](https://docs.python.org/3.7/library/stdtypes.html), such as the list of [all string methods](https://docs.python.org/3.7/library/stdtypes.html#string-methods)."
]
},
{
Expand Down Expand Up @@ -902,9 +902,9 @@
"source": [
"list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n",
"\n",
"for list1 in list_of_lists: # Iterate over elements in list_of_lists\n",
" print(list1) # Four blanks before the algorithm\n",
"print('Bye') # Without four blanck, this is not a part of iterations"
"for list1 in list_of_lists: # Iterate over elements in list_of_lists\n",
" print(list1) # Four blanks before the algorithm\n",
"print('Bye') # Without four blanks, this is not a part of iterations"
]
},
{
Expand Down Expand Up @@ -1085,7 +1085,7 @@
}
],
"source": [
"def sign(x): # Define a function with one argument x\n",
"def sign(x): # Define a function with one argument x\n",
" '''determine the sign of a single value'''\n",
" if x > 0: # four blanks before each line within the function body\n",
" return 'positive' # another four blanks within `if` expressions\n",
Expand Down

0 comments on commit 29ed998

Please sign in to comment.