multiline pre for data analysis with python
This commit is contained in:
@ -35,25 +35,21 @@ print(s.notnull().sum())
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>0 True
|
||||||
0 True
|
|
||||||
1 True
|
1 True
|
||||||
2 False
|
2 False
|
||||||
3 True
|
3 True
|
||||||
4 False
|
4 False
|
||||||
dtype: bool
|
dtype: bool</pre>
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>0 False
|
||||||
0 False
|
|
||||||
1 False
|
1 False
|
||||||
2 True
|
2 True
|
||||||
3 False
|
3 False
|
||||||
4 True
|
4 True
|
||||||
dtype: bool
|
dtype: bool</pre>
|
||||||
```
|
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -32,36 +32,36 @@ print(s)
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
0 1.0
|
0 1.0
|
||||||
1 1.0
|
1 1.0
|
||||||
2 2.0
|
2 2.0
|
||||||
3 3.0
|
3 3.0
|
||||||
4 3.0
|
4 3.0
|
||||||
dtype: float64
|
dtype: float64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
0 NaN
|
0 NaN
|
||||||
1 1.0
|
1 1.0
|
||||||
2 2.0
|
2 2.0
|
||||||
3 2.0
|
3 2.0
|
||||||
4 3.0
|
4 3.0
|
||||||
dtype: float64
|
dtype: float64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
0 NaN
|
0 NaN
|
||||||
1 1.0
|
1 1.0
|
||||||
2 2.0
|
2 2.0
|
||||||
3 NaN
|
3 NaN
|
||||||
4 3.0
|
4 3.0
|
||||||
dtype: float64
|
dtype: float64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -32,25 +32,25 @@ print(A[:, :2])
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```python
|
<pre>
|
||||||
[['a' 'b']]
|
[['a' 'b']]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[['b' 'c']
|
[['b' 'c']
|
||||||
['e' 'f']
|
['e' 'f']
|
||||||
['h' 'i']]
|
['h' 'i']]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```py
|
<pre>
|
||||||
[['a' 'b']
|
[['a' 'b']
|
||||||
['d' 'e']
|
['d' 'e']
|
||||||
['g' 'h']]
|
['g' 'h']]
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -38,33 +38,33 @@ print(certificates_earned)
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 13
|
Tom 13
|
||||||
Kris 11
|
Kris 11
|
||||||
Ahmad 9
|
Ahmad 9
|
||||||
Beau 7
|
Beau 7
|
||||||
Name: Longest streak, dtype: int64
|
Name: Longest streak, dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates Time (in months) Longest streak
|
Certificates Time (in months) Longest streak
|
||||||
Tom 8 16 13
|
Tom 8 16 13
|
||||||
Kris 2 5 11
|
Kris 2 5 11
|
||||||
Ahmad 5 9 9
|
Ahmad 5 9 9
|
||||||
Beau 6 12 7
|
Beau 6 12 7
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates Longest streak
|
Certificates Longest streak
|
||||||
Tom 8 13
|
Tom 8 13
|
||||||
Kris 2 11
|
Kris 2 11
|
||||||
Ahmad 5 9
|
Ahmad 5 9
|
||||||
Beau 6 7
|
Beau 6 7
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -20,13 +20,11 @@ More resources:
|
|||||||
|
|
||||||
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?
|
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?
|
||||||
|
|
||||||
```
|
<pre> Certificates Time (in months) Certificates per month
|
||||||
Certificates Time (in months) Certificates per month
|
|
||||||
Tom 8 16 0.50
|
Tom 8 16 0.50
|
||||||
Kris 2 5 0.40
|
Kris 2 5 0.40
|
||||||
Ahmad 5 9 0.56
|
Ahmad 5 9 0.56
|
||||||
Beau 6 12 0.50
|
Beau 6 12 0.50</pre>
|
||||||
```
|
|
||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
|
@ -35,29 +35,29 @@ print(certificates_earned.iloc[2])
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 16
|
Tom 16
|
||||||
Kris 5
|
Kris 5
|
||||||
Ahmad 9
|
Ahmad 9
|
||||||
Beau 12
|
Beau 12
|
||||||
Name: Time (in months), dtype: int64
|
Name: Time (in months), dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates 6
|
Certificates 6
|
||||||
Time (in months) 12
|
Time (in months) 12
|
||||||
Name: Beau, dtype: int64
|
Name: Beau, dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Certificates 5
|
Certificates 5
|
||||||
Time (in months) 9
|
Time (in months) 9
|
||||||
Name: Ahmad, dtype: int64
|
Name: Ahmad, dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -33,30 +33,30 @@ print(certificates_earned[certificates_earned > 5])
|
|||||||
|
|
||||||
## --answers--
|
## --answers--
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom True
|
Tom True
|
||||||
Kris False
|
Kris False
|
||||||
Ahmad False
|
Ahmad False
|
||||||
Beau True
|
Beau True
|
||||||
dtype: int64
|
dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 8
|
Tom 8
|
||||||
Ahmad 5
|
Ahmad 5
|
||||||
Beau 6
|
Beau 6
|
||||||
dtype: int64
|
dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Tom 8
|
Tom 8
|
||||||
Beau 6
|
Beau 6
|
||||||
dtype: int64
|
dtype: int64
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
## --video-solution--
|
## --video-solution--
|
||||||
|
|
||||||
|
@ -20,13 +20,13 @@ More resources:
|
|||||||
|
|
||||||
Given a file named `certificates.csv` with these contents:
|
Given a file named `certificates.csv` with these contents:
|
||||||
|
|
||||||
```
|
<pre>
|
||||||
Name$Certificates$Time (in months)
|
Name$Certificates$Time (in months)
|
||||||
Tom$8$16
|
Tom$8$16
|
||||||
Kris$2$5
|
Kris$2$5
|
||||||
Ahmad$5$9
|
Ahmad$5$9
|
||||||
Beau$6$12
|
Beau$6$12
|
||||||
```
|
</pre>
|
||||||
|
|
||||||
Fill in the blanks for the missing arguments below:
|
Fill in the blanks for the missing arguments below:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user