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