chore(learn): Applied MDX format to Chinese curriculum files (#40462)
This commit is contained in:
@ -4,32 +4,40 @@ challengeType: 11
|
||||
videoId: nVAaxZ34khk
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-pandas-real-life-example-24fa5bf8" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-pandas-real-life-example-24fa5bf8)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What does the shape of our dataframe tell us?
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
The size in gigabytes the dataframe we loaded into memory is.
|
||||
- |
|
||||
How many rows and columns our dataframe has.
|
||||
- |
|
||||
How many rows the source data had before loading.
|
||||
- |
|
||||
How many columns the source data had before loading.
|
||||
solution: 2
|
||||
```
|
||||
What does the shape of our dataframe tell us?
|
||||
|
||||
## --answers--
|
||||
|
||||
The size in gigabytes the dataframe we loaded into memory is.
|
||||
|
||||
---
|
||||
|
||||
How many rows and columns our dataframe has.
|
||||
|
||||
---
|
||||
|
||||
How many rows the source data had before loading.
|
||||
|
||||
---
|
||||
|
||||
How many columns the source data had before loading.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,30 +4,36 @@ challengeType: 11
|
||||
videoId: 0kJz0q0pvgQ
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-pandas-real-life-example-24fa5bf8" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-pandas-real-life-example-24fa5bf8)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What does the <code>loc</code> method allow you to do?
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
Retrieve a subset of rows and columns by supplying interger-location arguments.
|
||||
- |
|
||||
Access a group of rows and columns by supplying label(s) arguments.
|
||||
- |
|
||||
Returns the first <code>n</code> rows based on the integer argument supplied.
|
||||
solution: 2
|
||||
```
|
||||
What does the `loc` method allow you to do?
|
||||
|
||||
## --answers--
|
||||
|
||||
Retrieve a subset of rows and columns by supplying interger-location arguments.
|
||||
|
||||
---
|
||||
|
||||
Access a group of rows and columns by supplying label(s) arguments.
|
||||
|
||||
---
|
||||
|
||||
Returns the first `n` rows based on the integer argument supplied.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,33 +4,40 @@ challengeType: 11
|
||||
videoId: mHjxzFS5_Z0
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
When using Matplotlib's global API, what does the order of numbers mean here?
|
||||
```py
|
||||
plt.subplot(1, 2, 1)
|
||||
```
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
My figure will have one column, two rows, and I am going to start drawing in the first (left) plot.
|
||||
- |
|
||||
I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column.
|
||||
- |
|
||||
My figure will have one row, two columns, and I am going to start drawing in the first (left) plot.
|
||||
solution: 3
|
||||
````
|
||||
When using Matplotlib's global API, what does the order of numbers mean here?
|
||||
|
||||
```py
|
||||
plt.subplot(1, 2, 1)
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
My figure will have one column, two rows, and I am going to start drawing in the first (left) plot.
|
||||
|
||||
---
|
||||
|
||||
I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column.
|
||||
|
||||
---
|
||||
|
||||
My figure will have one row, two columns, and I am going to start drawing in the first (left) plot.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,30 +4,36 @@ challengeType: 11
|
||||
videoId: kj7QqjXhH6A
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
The Python method `.duplicated()` returns a boolean Series for your DataFrame. `True` is the return value for rows that:
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
contain a duplicate, where the value for the row contains the first occurrence of that value.
|
||||
- |
|
||||
contain a duplicate, where the value for the row is at least the second occurrence of that value.
|
||||
- |
|
||||
contain a duplicate, where the value for the row contains either the first or second occurrence.
|
||||
solution: 2
|
||||
```
|
||||
The Python method `.duplicated()` returns a boolean Series for your DataFrame. `True` is the return value for rows that:
|
||||
|
||||
## --answers--
|
||||
|
||||
contain a duplicate, where the value for the row contains the first occurrence of that value.
|
||||
|
||||
---
|
||||
|
||||
contain a duplicate, where the value for the row is at least the second occurrence of that value.
|
||||
|
||||
---
|
||||
|
||||
contain a duplicate, where the value for the row contains either the first or second occurrence.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,53 +4,59 @@ challengeType: 11
|
||||
videoId: ovYNhnltVxY
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
What will the following code print out?
|
||||
|
||||
s = pd.Series(['a', 3, np.nan, 1, np.nan])
|
||||
```py
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
print(s.notnull().sum())
|
||||
```
|
||||
s = pd.Series(['a', 3, np.nan, 1, np.nan])
|
||||
|
||||
answers:
|
||||
- |
|
||||
3
|
||||
- |
|
||||
```
|
||||
0 True
|
||||
1 True
|
||||
2 False
|
||||
3 True
|
||||
4 False
|
||||
dtype: bool
|
||||
```
|
||||
- |
|
||||
```
|
||||
0 False
|
||||
1 False
|
||||
2 True
|
||||
3 False
|
||||
4 True
|
||||
dtype: bool
|
||||
```
|
||||
solution: 1
|
||||
````
|
||||
print(s.notnull().sum())
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
3
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
0 True
|
||||
1 True
|
||||
2 False
|
||||
3 True
|
||||
4 False
|
||||
dtype: bool
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
0 False
|
||||
1 False
|
||||
2 True
|
||||
3 False
|
||||
4 True
|
||||
dtype: bool
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
1
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,61 +4,67 @@ challengeType: 11
|
||||
videoId: sTMN_pdI6S0
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/data-cleaning-rmotr-freecodecamp-fd76fa59)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
What will the following code print out?
|
||||
|
||||
s = pd.Series([np.nan, 1, 2, np.nan, 3])
|
||||
s = s.fillna(method='ffill')
|
||||
```py
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
print(s)
|
||||
```
|
||||
s = pd.Series([np.nan, 1, 2, np.nan, 3])
|
||||
s = s.fillna(method='ffill')
|
||||
|
||||
answers:
|
||||
- |
|
||||
```
|
||||
0 1.0
|
||||
1 1.0
|
||||
2 2.0
|
||||
3 3.0
|
||||
4 3.0
|
||||
dtype: float64
|
||||
```
|
||||
- |
|
||||
```
|
||||
0 NaN
|
||||
1 1.0
|
||||
2 2.0
|
||||
3 2.0
|
||||
4 3.0
|
||||
dtype: float64
|
||||
```
|
||||
- |
|
||||
```
|
||||
0 NaN
|
||||
1 1.0
|
||||
2 2.0
|
||||
3 NaN
|
||||
4 3.0
|
||||
dtype: float64
|
||||
```
|
||||
solution: 2
|
||||
````
|
||||
print(s)
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```
|
||||
0 1.0
|
||||
1 1.0
|
||||
2 2.0
|
||||
3 3.0
|
||||
4 3.0
|
||||
dtype: float64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
0 NaN
|
||||
1 1.0
|
||||
2 2.0
|
||||
3 2.0
|
||||
4 3.0
|
||||
dtype: float64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
0 NaN
|
||||
1 1.0
|
||||
2 2.0
|
||||
3 NaN
|
||||
4 3.0
|
||||
dtype: float64
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,31 +4,38 @@ challengeType: 11
|
||||
videoId: h8caJq2Bb9w
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial-ac5fa63f" target='_blank'>Notebook</a>
|
||||
- <a href="https://twitter.com/rmotr_com/status/1122176794696847361" target='_blank'>Twitter Cheat Sheet</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial-ac5fa63f)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Twitter Cheat Sheet](https://twitter.com/rmotr_com/status/1122176794696847361)
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What is **not** allowed in a Jupyter Notebook's cell?
|
||||
# --question--
|
||||
|
||||
answers:
|
||||
- |
|
||||
Markdown
|
||||
- |
|
||||
Python code
|
||||
- |
|
||||
An Excel sheet
|
||||
solution: 3
|
||||
```
|
||||
## --text--
|
||||
|
||||
What is **not** allowed in a Jupyter Notebook's cell?
|
||||
|
||||
## --answers--
|
||||
|
||||
Markdown
|
||||
|
||||
---
|
||||
|
||||
Python code
|
||||
|
||||
---
|
||||
|
||||
An Excel sheet
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,32 +4,40 @@ challengeType: 11
|
||||
videoId: VJrP2FUzKP0
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://docs.google.com/presentation/d/1fDpjlyMiOMJyuc7_jMekcYLPP2XlSl1eWw9F7yE7byk" target='_blank'>Slides</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Slides](https://docs.google.com/presentation/d/1fDpjlyMiOMJyuc7_jMekcYLPP2XlSl1eWw9F7yE7byk)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
Why should you choose R over Python for data analysis?
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
It's simple to learn.
|
||||
- |
|
||||
It's better at dealing with advanced statistical methods.
|
||||
- |
|
||||
There are many powerful libraries that support R.
|
||||
- |
|
||||
It's free and open source.
|
||||
solution: 2
|
||||
```
|
||||
Why should you choose R over Python for data analysis?
|
||||
|
||||
## --answers--
|
||||
|
||||
It's simple to learn.
|
||||
|
||||
---
|
||||
|
||||
It's better at dealing with advanced statistical methods.
|
||||
|
||||
---
|
||||
|
||||
There are many powerful libraries that support R.
|
||||
|
||||
---
|
||||
|
||||
It's free and open source.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,31 +4,38 @@ challengeType: 11
|
||||
videoId: 5PPegAs9aLA
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial-ac5fa63f" target='_blank'>Notebook</a>
|
||||
- <a href="https://twitter.com/rmotr_com/status/1122176794696847361" target='_blank'>Twitter Cheat Sheet</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial-ac5fa63f)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Twitter Cheat Sheet](https://twitter.com/rmotr_com/status/1122176794696847361)
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
Which cells are responsible for rich display?
|
||||
# --question--
|
||||
|
||||
answers:
|
||||
- |
|
||||
Code Cells
|
||||
- |
|
||||
Markdown Cells
|
||||
- |
|
||||
Raw Cells
|
||||
solution: 1
|
||||
```
|
||||
## --text--
|
||||
|
||||
Which cells are responsible for rich display?
|
||||
|
||||
## --answers--
|
||||
|
||||
Code Cells
|
||||
|
||||
---
|
||||
|
||||
Markdown Cells
|
||||
|
||||
---
|
||||
|
||||
Raw Cells
|
||||
|
||||
## --video-solution--
|
||||
|
||||
1
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,35 +4,46 @@ challengeType: 11
|
||||
videoId: k1msxD3JIxE
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial-ac5fa63f" target='_blank'>Notebook</a>
|
||||
- <a href="https://twitter.com/rmotr_com/status/1122176794696847361" target='_blank'>Twitter Cheat Sheet</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial-ac5fa63f)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Twitter Cheat Sheet](https://twitter.com/rmotr_com/status/1122176794696847361)
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What kind of data can you import and work with in a Jupyter Notebook?
|
||||
# --question--
|
||||
|
||||
answers:
|
||||
- |
|
||||
Excel files.
|
||||
- |
|
||||
CSV files.
|
||||
- |
|
||||
XML files.
|
||||
- |
|
||||
Data from an API.
|
||||
- |
|
||||
All of the above.
|
||||
solution: 5
|
||||
```
|
||||
## --text--
|
||||
|
||||
What kind of data can you import and work with in a Jupyter Notebook?
|
||||
|
||||
## --answers--
|
||||
|
||||
Excel files.
|
||||
|
||||
---
|
||||
|
||||
CSV files.
|
||||
|
||||
---
|
||||
|
||||
XML files.
|
||||
|
||||
---
|
||||
|
||||
Data from an API.
|
||||
|
||||
---
|
||||
|
||||
All of the above.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
5
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,32 +4,40 @@ challengeType: 11
|
||||
videoId: XAT97YLOKD8
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What is the relationship between size of objects (such as lists and datatypes) in memory in Python's standard library and the NumPy library? Knowing this, what are the implications for performance?
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
Standard Python objects take up much more memory to store than NumPy objects; operations on comparable standard Python and NumPy objects complete in roughly the same time.
|
||||
- |
|
||||
NumPy objects take up much more memory than standard Python objects; operations on NumPy objects complete very quickly compared to comparable objects in standard Python.
|
||||
- |
|
||||
NumPy objects take up much less memory than Standard Python objects; operations on Standard Python objects complete very quickly compared to comparable objects on NumPy Object.
|
||||
- |
|
||||
Standard Python objects take up more memory than NumPy objects; operations on NumPy objects complete very quickly compared to comparable objects in standard Python.
|
||||
solution: 4
|
||||
```
|
||||
What is the relationship between size of objects (such as lists and datatypes) in memory in Python's standard library and the NumPy library? Knowing this, what are the implications for performance?
|
||||
|
||||
## --answers--
|
||||
|
||||
Standard Python objects take up much more memory to store than NumPy objects; operations on comparable standard Python and NumPy objects complete in roughly the same time.
|
||||
|
||||
---
|
||||
|
||||
NumPy objects take up much more memory than standard Python objects; operations on NumPy objects complete very quickly compared to comparable objects in standard Python.
|
||||
|
||||
---
|
||||
|
||||
NumPy objects take up much less memory than Standard Python objects; operations on Standard Python objects complete very quickly compared to comparable objects on NumPy Object.
|
||||
|
||||
---
|
||||
|
||||
Standard Python objects take up more memory than NumPy objects; operations on NumPy objects complete very quickly compared to comparable objects in standard Python.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,50 +4,56 @@ challengeType: 11
|
||||
videoId: VDYVFHBL1AM
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
A = np.array([
|
||||
['a', 'b', 'c'],
|
||||
['d', 'e', 'f'],
|
||||
['g', 'h', 'i']
|
||||
])
|
||||
What will the following code print out?
|
||||
|
||||
print(A[:, :2])
|
||||
```
|
||||
```py
|
||||
A = np.array([
|
||||
['a', 'b', 'c'],
|
||||
['d', 'e', 'f'],
|
||||
['g', 'h', 'i']
|
||||
])
|
||||
|
||||
answers:
|
||||
- |
|
||||
```python
|
||||
[['a' 'b']]
|
||||
```
|
||||
- |
|
||||
```py
|
||||
[['b' 'c']
|
||||
['e' 'f']
|
||||
['h' 'i']]
|
||||
```
|
||||
- |
|
||||
```py
|
||||
[['a' 'b']
|
||||
['d' 'e']
|
||||
['g' 'h']]
|
||||
```
|
||||
solution: 3
|
||||
````
|
||||
print(A[:, :2])
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```python
|
||||
[['a' 'b']]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```py
|
||||
[['b' 'c']
|
||||
['e' 'f']
|
||||
['h' 'i']]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```py
|
||||
[['a' 'b']
|
||||
['d' 'e']
|
||||
['g' 'h']]
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,45 +4,54 @@ challengeType: 11
|
||||
videoId: N1ttsMmcVMM
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
a = np.arange(5)
|
||||
What will the following code print out?
|
||||
|
||||
print(a <= 3)
|
||||
```
|
||||
answers:
|
||||
- |
|
||||
```python
|
||||
[False, False, False, False, True]
|
||||
```
|
||||
- |
|
||||
```python
|
||||
[5]
|
||||
```
|
||||
- |
|
||||
```python
|
||||
[0, 1, 2, 3]
|
||||
```
|
||||
- |
|
||||
```python
|
||||
[True, True, True, True, False]
|
||||
```
|
||||
solution: 4
|
||||
````
|
||||
```py
|
||||
a = np.arange(5)
|
||||
|
||||
print(a <= 3)
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```python
|
||||
[False, False, False, False, True]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
[5]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
[0, 1, 2, 3]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
[True, True, True, True, False]
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,30 +4,36 @@ challengeType: 11
|
||||
videoId: P-JjV6GBCmk
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
Why is Numpy an important, but unpopular Python library?
|
||||
## --text--
|
||||
|
||||
answers:
|
||||
- |
|
||||
Often you won't work directly with Numpy.
|
||||
- |
|
||||
It's is extremely slow.
|
||||
- |
|
||||
Working with Numpy is difficult.
|
||||
solution: 1
|
||||
```
|
||||
Why is Numpy an important, but unpopular Python library?
|
||||
|
||||
## --answers--
|
||||
|
||||
Often you won't work directly with Numpy.
|
||||
|
||||
---
|
||||
|
||||
It's is extremely slow.
|
||||
|
||||
---
|
||||
|
||||
Working with Numpy is difficult.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
1
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,31 +4,40 @@ challengeType: 11
|
||||
videoId: YIqgrNLAZkA
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
About how much memory does the integer `5` consume in plain Python?
|
||||
answers:
|
||||
- |
|
||||
32 bits
|
||||
- |
|
||||
20 bytes
|
||||
- |
|
||||
16 bytes
|
||||
- |
|
||||
8 bits
|
||||
solution: 2
|
||||
```
|
||||
## --text--
|
||||
|
||||
About how much memory does the integer `5` consume in plain Python?
|
||||
|
||||
## --answers--
|
||||
|
||||
32 bits
|
||||
|
||||
---
|
||||
|
||||
20 bytes
|
||||
|
||||
---
|
||||
|
||||
16 bytes
|
||||
|
||||
---
|
||||
|
||||
8 bits
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,41 +4,47 @@ challengeType: 11
|
||||
videoId: eqSVcJbaPdk
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-numpy-6c285b74)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What is the value of `a` after you run the following code?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
a = np.arange(5)
|
||||
a + 20
|
||||
```
|
||||
What is the value of `a` after you run the following code?
|
||||
|
||||
answers:
|
||||
- |
|
||||
```python
|
||||
[20, 21, 22, 24, 24]
|
||||
```
|
||||
- |
|
||||
```python
|
||||
[0, 1, 2, 3, 4]
|
||||
```
|
||||
- |
|
||||
```python
|
||||
[25, 26, 27, 28, 29]
|
||||
```
|
||||
solution: 2
|
||||
````
|
||||
```py
|
||||
a = np.arange(5)
|
||||
a + 20
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```python
|
||||
[20, 21, 22, 24, 24]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
[0, 1, 2, 3, 4]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
[25, 26, 27, 28, 29]
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,64 +4,70 @@ challengeType: 11
|
||||
videoId: BFlH0fN5xRQ
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
import pandas as pd
|
||||
What will the following code print out?
|
||||
|
||||
certificates_earned = pd.DataFrame({
|
||||
'Certificates': [8, 2, 5, 6],
|
||||
'Time (in months)': [16, 5, 9, 12]
|
||||
})
|
||||
names = ['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
```py
|
||||
import pandas as pd
|
||||
|
||||
certificates_earned.index = names
|
||||
longest_streak = pd.Series([13, 11, 9, 7], index=names)
|
||||
certificates_earned['Longest streak'] = longest_streak
|
||||
certificates_earned = pd.DataFrame({
|
||||
'Certificates': [8, 2, 5, 6],
|
||||
'Time (in months)': [16, 5, 9, 12]
|
||||
})
|
||||
names = ['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
|
||||
print(certificates_earned)
|
||||
```
|
||||
certificates_earned.index = names
|
||||
longest_streak = pd.Series([13, 11, 9, 7], index=names)
|
||||
certificates_earned['Longest streak'] = longest_streak
|
||||
|
||||
answers:
|
||||
- |
|
||||
```
|
||||
Tom 13
|
||||
Kris 11
|
||||
Ahmad 9
|
||||
Beau 7
|
||||
Name: Longest streak, dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Certificates Time (in months) Longest streak
|
||||
Tom 8 16 13
|
||||
Kris 2 5 11
|
||||
Ahmad 5 9 9
|
||||
Beau 6 12 7
|
||||
```
|
||||
- |
|
||||
```
|
||||
Certificates Longest streak
|
||||
Tom 8 13
|
||||
Kris 2 11
|
||||
Ahmad 5 9
|
||||
Beau 6 7
|
||||
```
|
||||
solution: 2
|
||||
````
|
||||
print(certificates_earned)
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```
|
||||
Tom 13
|
||||
Kris 11
|
||||
Ahmad 9
|
||||
Beau 7
|
||||
Name: Longest streak, dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Certificates Time (in months) Longest streak
|
||||
Tom 8 16 13
|
||||
Kris 2 5 11
|
||||
Ahmad 5 9 9
|
||||
Beau 6 12 7
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Certificates Longest streak
|
||||
Tom 8 13
|
||||
Kris 2 11
|
||||
Ahmad 5 9
|
||||
Beau 6 7
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,51 +4,57 @@ challengeType: 11
|
||||
videoId: _sSo2XZoB3E
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?
|
||||
## --text--
|
||||
|
||||
```
|
||||
Certificates Time (in months) Certificates per month
|
||||
Tom 8 16 0.50
|
||||
Kris 2 5 0.40
|
||||
Ahmad 5 9 0.56
|
||||
Beau 6 12 0.50
|
||||
```
|
||||
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?
|
||||
|
||||
answers:
|
||||
- |
|
||||
```py
|
||||
certificates_earned['Certificates'] /
|
||||
certificates_earned['Time (in months)']
|
||||
```
|
||||
- |
|
||||
```py
|
||||
certificates_earned['Certificates per month'] = round(
|
||||
certificates_earned['Certificates'] /
|
||||
certificates_earned['Time (in months)']
|
||||
)
|
||||
```
|
||||
- |
|
||||
```py
|
||||
certificates_earned['Certificates per month'] = round(
|
||||
certificates_earned['Certificates'] /
|
||||
certificates_earned['Time (in months)'], 2
|
||||
)
|
||||
```
|
||||
solution: 3
|
||||
````
|
||||
```
|
||||
Certificates Time (in months) Certificates per month
|
||||
Tom 8 16 0.50
|
||||
Kris 2 5 0.40
|
||||
Ahmad 5 9 0.56
|
||||
Beau 6 12 0.50
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```py
|
||||
certificates_earned['Certificates'] /
|
||||
certificates_earned['Time (in months)']
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```py
|
||||
certificates_earned['Certificates per month'] = round(
|
||||
certificates_earned['Certificates'] /
|
||||
certificates_earned['Time (in months)']
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```py
|
||||
certificates_earned['Certificates per month'] = round(
|
||||
certificates_earned['Certificates'] /
|
||||
certificates_earned['Time (in months)'], 2
|
||||
)
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,57 +4,63 @@ challengeType: 11
|
||||
videoId: 7SgFBYXaiH0
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
import pandas as pd
|
||||
What will the following code print out?
|
||||
|
||||
certificates_earned = pd.DataFrame({
|
||||
'Certificates': [8, 2, 5, 6],
|
||||
'Time (in months)': [16, 5, 9, 12]
|
||||
})
|
||||
```py
|
||||
import pandas as pd
|
||||
|
||||
certificates_earned.index = ['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
certificates_earned = pd.DataFrame({
|
||||
'Certificates': [8, 2, 5, 6],
|
||||
'Time (in months)': [16, 5, 9, 12]
|
||||
})
|
||||
|
||||
print(certificates_earned.iloc[2])
|
||||
```
|
||||
certificates_earned.index = ['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
|
||||
answers:
|
||||
- |
|
||||
```
|
||||
Tom 16
|
||||
Kris 5
|
||||
Ahmad 9
|
||||
Beau 12
|
||||
Name: Time (in months), dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Certificates 6
|
||||
Time (in months) 12
|
||||
Name: Beau, dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Certificates 5
|
||||
Time (in months) 9
|
||||
Name: Ahmad, dtype: int64
|
||||
```
|
||||
solution: 3
|
||||
````
|
||||
print(certificates_earned.iloc[2])
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```
|
||||
Tom 16
|
||||
Kris 5
|
||||
Ahmad 9
|
||||
Beau 12
|
||||
Name: Time (in months), dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Certificates 6
|
||||
Time (in months) 12
|
||||
Name: Beau, dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Certificates 5
|
||||
Time (in months) 9
|
||||
Name: Ahmad, dtype: int64
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -1,59 +1,65 @@
|
||||
---
|
||||
id: 5e9a093a74c4063ca6f7c159
|
||||
challengeType: 11
|
||||
videoId: -ZOrgV_aA9A
|
||||
videoId: '-ZOrgV_aA9A'
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
import pandas as pd
|
||||
What will the following code print out?
|
||||
|
||||
certificates_earned = pd.Series(
|
||||
[8, 2, 5, 6],
|
||||
index=['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
)
|
||||
```py
|
||||
import pandas as pd
|
||||
|
||||
print(certificates_earned[certificates_earned > 5])
|
||||
```
|
||||
certificates_earned = pd.Series(
|
||||
[8, 2, 5, 6],
|
||||
index=['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
)
|
||||
|
||||
answers:
|
||||
- |
|
||||
```
|
||||
Tom True
|
||||
Kris False
|
||||
Ahmad False
|
||||
Beau True
|
||||
dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Tom 8
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Tom 8
|
||||
Beau 6
|
||||
dtype: int64
|
||||
```
|
||||
solution: 3
|
||||
````
|
||||
print(certificates_earned[certificates_earned > 5])
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```
|
||||
Tom True
|
||||
Kris False
|
||||
Ahmad False
|
||||
Beau True
|
||||
dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Tom 8
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Tom 8
|
||||
Beau 6
|
||||
dtype: int64
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,59 +4,65 @@ challengeType: 11
|
||||
videoId: 0xACW-8cZU0
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/freecodecamp-intro-to-pandas-902ae59b)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
What will the following code print out?
|
||||
## --text--
|
||||
|
||||
```py
|
||||
import pandas as pd
|
||||
What will the following code print out?
|
||||
|
||||
certificates_earned = pd.Series(
|
||||
[8, 2, 5, 6],
|
||||
index=['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
)
|
||||
```py
|
||||
import pandas as pd
|
||||
|
||||
print(certificates_earned)
|
||||
```
|
||||
certificates_earned = pd.Series(
|
||||
[8, 2, 5, 6],
|
||||
index=['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||
)
|
||||
|
||||
answers:
|
||||
- |
|
||||
```
|
||||
Tom 8
|
||||
Kris 2
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Kris 2
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
Tom 8
|
||||
dtype: int64
|
||||
```
|
||||
- |
|
||||
```
|
||||
Tom 8
|
||||
Kris 2
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
Name: certificates_earned dtype: int64
|
||||
```
|
||||
solution: 1
|
||||
````
|
||||
print(certificates_earned)
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
```
|
||||
Tom 8
|
||||
Kris 2
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Kris 2
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
Tom 8
|
||||
dtype: int64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Tom 8
|
||||
Kris 2
|
||||
Ahmad 5
|
||||
Beau 6
|
||||
Name: certificates_earned dtype: int64
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
1
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,34 +4,46 @@ challengeType: 11
|
||||
videoId: bJaqnTWQmb0
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46" target='_blank'>Reading CSVs Notebook</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b" target='_blank'>Reading SQL</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73" target='_blank'>Reading HTML</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973" target='_blank'>Reading Excel files</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Reading CSVs Notebook](https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Reading SQL](https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b)
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What Python library has the `.read_html()` method we can we use for parsing HTML documents and extracting tables?
|
||||
answers:
|
||||
- |
|
||||
BeautifierSoupy
|
||||
- |
|
||||
WebReader
|
||||
- |
|
||||
HTTP-master
|
||||
- |
|
||||
Pandas
|
||||
solution: 4
|
||||
```
|
||||
\- [Reading HTML](https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73)
|
||||
|
||||
\- [Reading Excel files](https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973)
|
||||
|
||||
# --question--
|
||||
|
||||
## --text--
|
||||
|
||||
What Python library has the `.read_html()` method we can we use for parsing HTML documents and extracting tables?
|
||||
|
||||
## --answers--
|
||||
|
||||
BeautifierSoupy
|
||||
|
||||
---
|
||||
|
||||
WebReader
|
||||
|
||||
---
|
||||
|
||||
HTTP-master
|
||||
|
||||
---
|
||||
|
||||
Pandas
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,29 +4,36 @@ challengeType: 11
|
||||
videoId: NzpU17ZVlUw
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/python-under-10-minutes-15addcb2" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/python-under-10-minutes-15addcb2)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What is the main difference between lists and tuples in Python?
|
||||
answers:
|
||||
- |
|
||||
Tuples are immutable.
|
||||
- |
|
||||
Lists are ordered.
|
||||
- |
|
||||
Tuples are unordered.
|
||||
solution: 1
|
||||
```
|
||||
## --text--
|
||||
|
||||
What is the main difference between lists and tuples in Python?
|
||||
|
||||
## --answers--
|
||||
|
||||
Tuples are immutable.
|
||||
|
||||
---
|
||||
|
||||
Lists are ordered.
|
||||
|
||||
---
|
||||
|
||||
Tuples are unordered.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
1
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,31 +4,40 @@ challengeType: 11
|
||||
videoId: PrQV9JkLhb4
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/python-under-10-minutes-15addcb2" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/python-under-10-minutes-15addcb2)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
How do we define blocks of code in the body of functions in Python?
|
||||
answers:
|
||||
- |
|
||||
We use a set of curly braces, one on either side of each new block of our code.
|
||||
- |
|
||||
We use indentation, usually right-aligned 4 spaces.
|
||||
- |
|
||||
We do not denote blocks of code.
|
||||
- |
|
||||
We could use curly braces or indentation to denote blocks of code.
|
||||
solution: 2
|
||||
```
|
||||
## --text--
|
||||
|
||||
How do we define blocks of code in the body of functions in Python?
|
||||
|
||||
## --answers--
|
||||
|
||||
We use a set of curly braces, one on either side of each new block of our code.
|
||||
|
||||
---
|
||||
|
||||
We use indentation, usually right-aligned 4 spaces.
|
||||
|
||||
---
|
||||
|
||||
We do not denote blocks of code.
|
||||
|
||||
---
|
||||
|
||||
We could use curly braces or indentation to denote blocks of code.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,44 +4,53 @@ challengeType: 11
|
||||
videoId: XzosGWLafrY
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/python-under-10-minutes-15addcb2" target='_blank'>Notebook</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Notebook](https://notebooks.ai/rmotr-curriculum/python-under-10-minutes-15addcb2)
|
||||
|
||||
<section id='tests'>
|
||||
# --question--
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
How would you iterate over and print the keys and values of a dictionary named `user`?
|
||||
answers:
|
||||
- |
|
||||
```python
|
||||
for key in user.items():
|
||||
print(key)
|
||||
```
|
||||
- |
|
||||
```python
|
||||
for key, value in user.all():
|
||||
print(key, value)
|
||||
print(value)
|
||||
```
|
||||
- |
|
||||
```python
|
||||
for key, value in user.items():
|
||||
print(key, value)
|
||||
```
|
||||
- |
|
||||
```python
|
||||
for key, value in user
|
||||
print(key, value)
|
||||
```
|
||||
solution: 3
|
||||
````
|
||||
## --text--
|
||||
|
||||
How would you iterate over and print the keys and values of a dictionary named `user`?
|
||||
|
||||
## --answers--
|
||||
|
||||
```python
|
||||
for key in user.items():
|
||||
print(key)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
for key, value in user.all():
|
||||
print(key, value)
|
||||
print(value)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
for key, value in user.items():
|
||||
print(key, value)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
for key, value in user
|
||||
print(key, value)
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,46 +4,58 @@ challengeType: 11
|
||||
videoId: ViGEv0zOzUk
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46" target='_blank'>Reading CSVs Notebook</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b" target='_blank'>Reading SQL</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73" target='_blank'>Reading HTML</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973" target='_blank'>Reading Excel files</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Reading CSVs Notebook](https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Reading SQL](https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b)
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
How would you import the CSV file `data.csv` and store it in a DataFrame using the Pandas module?
|
||||
answers:
|
||||
- |
|
||||
```python
|
||||
import pandas as pd
|
||||
df = pd.csv("data.csv")
|
||||
```
|
||||
- |
|
||||
```python
|
||||
import pandas as pd
|
||||
df = pd.read_csv("data.csv")
|
||||
```
|
||||
- |
|
||||
```python
|
||||
import pandas as pd
|
||||
pd.read_csv("data.csv")
|
||||
```
|
||||
- |
|
||||
```python
|
||||
import pandas as pd
|
||||
df = pd.csv_reader("data.csv")
|
||||
```
|
||||
solution: 2
|
||||
````
|
||||
\- [Reading HTML](https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73)
|
||||
|
||||
\- [Reading Excel files](https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973)
|
||||
|
||||
# --question--
|
||||
|
||||
## --text--
|
||||
|
||||
How would you import the CSV file `data.csv` and store it in a DataFrame using the Pandas module?
|
||||
|
||||
## --answers--
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
df = pd.csv("data.csv")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
df = pd.read_csv("data.csv")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
pd.read_csv("data.csv")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
df = pd.csv_reader("data.csv")
|
||||
```
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,32 +4,42 @@ challengeType: 11
|
||||
videoId: MtgXS1MofRw
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46" target='_blank'>Reading CSVs Notebook</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b" target='_blank'>Reading SQL</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73" target='_blank'>Reading HTML</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973" target='_blank'>Reading Excel files</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Reading CSVs Notebook](https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Reading SQL](https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b)
|
||||
|
||||
```yml
|
||||
question:
|
||||
text: |
|
||||
What method does a `Cursor` instance have and what does it allow?
|
||||
answers:
|
||||
- |
|
||||
The `Cursor` instance has a `.run()` method which allows you to run SQL queries.
|
||||
- |
|
||||
The `Cursor` instance has a `.select()` method which allows you to select records.
|
||||
- |
|
||||
The `Cursor` instance has an `.execute()` method which will receive SQL parameters to run against the database.
|
||||
solution: 3
|
||||
```
|
||||
\- [Reading HTML](https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73)
|
||||
|
||||
\- [Reading Excel files](https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973)
|
||||
|
||||
# --question--
|
||||
|
||||
## --text--
|
||||
|
||||
What method does a `Cursor` instance have and what does it allow?
|
||||
|
||||
## --answers--
|
||||
|
||||
The `Cursor` instance has a `.run()` method which allows you to run SQL queries.
|
||||
|
||||
---
|
||||
|
||||
The `Cursor` instance has a `.select()` method which allows you to select records.
|
||||
|
||||
---
|
||||
|
||||
The `Cursor` instance has an `.execute()` method which will receive SQL parameters to run against the database.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
@ -4,66 +4,75 @@ challengeType: 11
|
||||
videoId: cDnt02BcHng
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
More resources:
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46" target='_blank'>Reading CSVs Notebook</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b" target='_blank'>Reading SQL</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73" target='_blank'>Reading HTML</a>
|
||||
- <a href="https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973" target='_blank'>Reading Excel files</a>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
\- [Reading CSVs Notebook](https://notebooks.ai/rmotr-curriculum/rdp-reading-csv-and-txt-files-fb829f46)
|
||||
|
||||
<section id='tests'>
|
||||
\- [Reading SQL](https://notebooks.ai/rmotr-curriculum/rdp-reading-data-from-relational-databases-2a3a889b)
|
||||
|
||||
````yml
|
||||
question:
|
||||
text: |
|
||||
Given a file named `certificates.csv` with these contents:
|
||||
\- [Reading HTML](https://notebooks.ai/rmotr-curriculum/rdp-reading-html-tables-eb9cca73)
|
||||
|
||||
```
|
||||
Name$Certificates$Time (in months)
|
||||
Tom$8$16
|
||||
Kris$2$5
|
||||
Ahmad$5$9
|
||||
Beau$6$12
|
||||
```
|
||||
\- [Reading Excel files](https://notebooks.ai/rmotr-curriculum/rdp-reading-excel-files-a6b99973)
|
||||
|
||||
Fill in the blanks for the missing arguments below:
|
||||
# --question--
|
||||
|
||||
```py
|
||||
import csv
|
||||
## --text--
|
||||
|
||||
with open(__A__, 'r') as fp:
|
||||
reader = csv.reader(fp, delimiter=__B__)
|
||||
next(reader)
|
||||
for index, values in enumerate(reader):
|
||||
name, certs_num, months_num = values
|
||||
print(f"{name} earned {__C__} certificates in {months_num} months")
|
||||
```
|
||||
Given a file named `certificates.csv` with these contents:
|
||||
|
||||
answers:
|
||||
- |
|
||||
A: `'certificates.csv'`
|
||||
```
|
||||
Name$Certificates$Time (in months)
|
||||
Tom$8$16
|
||||
Kris$2$5
|
||||
Ahmad$5$9
|
||||
Beau$6$12
|
||||
```
|
||||
|
||||
B: `'-'`
|
||||
Fill in the blanks for the missing arguments below:
|
||||
|
||||
C: `values`
|
||||
- |
|
||||
A: `'certificates.csv'`
|
||||
```py
|
||||
import csv
|
||||
|
||||
B: `'$'`
|
||||
with open(__A__, 'r') as fp:
|
||||
reader = csv.reader(fp, delimiter=__B__)
|
||||
next(reader)
|
||||
for index, values in enumerate(reader):
|
||||
name, certs_num, months_num = values
|
||||
print(f"{name} earned {__C__} certificates in {months_num} months")
|
||||
```
|
||||
|
||||
C: `certs_num`
|
||||
- |
|
||||
A: `'certificates'`
|
||||
## --answers--
|
||||
|
||||
B: `'$'`
|
||||
A: `'certificates.csv'`
|
||||
|
||||
C: `certs_num`
|
||||
solution: 2
|
||||
````
|
||||
B: `'-'`
|
||||
|
||||
C: `values`
|
||||
|
||||
---
|
||||
|
||||
A: `'certificates.csv'`
|
||||
|
||||
B: `'$'`
|
||||
|
||||
C: `certs_num`
|
||||
|
||||
---
|
||||
|
||||
A: `'certificates'`
|
||||
|
||||
B: `'$'`
|
||||
|
||||
C: `certs_num`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
2
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user