Skip to content

Commit 922c135

Browse files
committed
ex 04
1 parent 5659574 commit 922c135

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

.learn/exercises/03-Dataset/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Download the Dataset
1+
# `03` Download the Dataset
22

33
In machine learning "datasets" are the data we use for our experiments, we usually feed these datasets to "models" and experiment in different ways, the goal is always to predict something.
44

.learn/exercises/04-Series/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Series
1+
# `04` Series
22

33
A series is similar to an array or list, it's a one dimentional data structure.
44

.learn/exercises/04-Series/test.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import pytest, re, os, io, sys
2+
3+
@pytest.mark.it('You must import pandas')
4+
def test_import_pandas():
5+
path = os.path.dirname(os.path.abspath('app.py'))+'/app.py'
6+
with open(path, 'r') as content_file:
7+
content = content_file.read()
8+
regex = re.compile(r"import\s*pandas")
9+
assert bool(regex.search(content)) == True
10+
11+
@pytest.mark.it('The variable ages must exist')
12+
def test_vatiable_existence():
13+
from app import ages
14+
15+
@pytest.mark.it('The output should be the expected')
16+
def test_expected_output(capsys):
17+
import app
18+
captured = capsys.readouterr()
19+
assert captured.out == """0 23
20+
1 45
21+
2 7
22+
3 34
23+
4 6
24+
5 63
25+
6 36
26+
7 78
27+
8 54
28+
9 34
29+
dtype: int64
30+
31+
"""

app.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import pandas as pd
1+
import pandas as pd
2+
# two dimensional array of name,age values.
3+
ages = pd.Series([23,45,7,34,6,63,36,78,54,34])
24

3-
data_frame = pd.read_csv('.learn/assets/pokemon_data.csv')
4-
print(data_frame)
5+
print(ages)
56

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def pytest_generate_tests(metafunc):
2424
except AttributeError:
2525
metafunc.parametrize("app",[cached_app])
2626
if 'configuration' in metafunc.fixturenames:
27-
metafunc.parametrize("configuration", [json.loads('{"port":3000,"address":"https://kiddopro-pythonpandastut-zzjbcc6h0h1.ws-us34.gitpod.io","editor":{"mode":"preview","agent":"gitpod","version":"1.0.72"},"dirPath":"./.learn","configPath":"learn.json","outputPath":".learn/dist","publicPath":"/preview","publicUrl":"https://3000-kiddopro-pythonpandastut-zzjbcc6h0h1.ws-us34.gitpod.io","language":"auto","grading":"incremental","exercisesPath":".learn/exercises","webpackTemplate":null,"disableGrading":false,"disabledActions":["build"],"actions":[],"entries":{"html":"index.html","vanillajs":"index.js","react":"app.jsx","node":"app.js","python3":"app.py","java":"app.java"},"preview":"https://github.com/4GeeksAcademy/python-pandas-tutorial/blob/main/.learn/assets/pandas-preview.jpeg?raw=true","difficulty":"beginner","duration":3,"description":"Learn the basics and become comfortable using pandas for manipulating machine learning datasets .","title":"Pandas for Machine Learning","slug":"pandas-for-machine-learning","session":2664118464753879600,"translations":[]}')])
27+
metafunc.parametrize("configuration", [json.loads('{"port":3000,"address":"https://kiddopro-pythonpandastut-zzjbcc6h0h1.ws-us34.gitpod.io","editor":{"mode":"preview","agent":"gitpod","version":"1.0.72"},"dirPath":"./.learn","configPath":"learn.json","outputPath":".learn/dist","publicPath":"/preview","publicUrl":"https://3000-kiddopro-pythonpandastut-zzjbcc6h0h1.ws-us34.gitpod.io","language":"auto","grading":"incremental","exercisesPath":".learn/exercises","webpackTemplate":null,"disableGrading":false,"disabledActions":["build"],"actions":[],"entries":{"html":"index.html","vanillajs":"index.js","react":"app.jsx","node":"app.js","python3":"app.py","java":"app.java"},"preview":"https://github.com/4GeeksAcademy/python-pandas-tutorial/blob/main/.learn/assets/pandas-preview.jpeg?raw=true","difficulty":"beginner","duration":3,"description":"Learn the basics and become comfortable using pandas for manipulating machine learning datasets .","title":"Pandas for Machine Learning","slug":"pandas-for-machine-learning","session":7340087717416326000,"translations":[]}')])

0 commit comments

Comments
 (0)