Skip to content

Commit 4b0f2b7

Browse files
adding remaining datasets used in text
1 parent 5108a89 commit 4b0f2b7

File tree

5 files changed

+25177
-4
lines changed

5 files changed

+25177
-4
lines changed

fundamentals_of_data_science/datasets/__init__.py

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,71 @@
22
import pandas as pd
33

44

5-
def example():
5+
def imports_85():
66
"""
7-
Returns the example dataset.
7+
Returns the imports-85 dataset.
88
99
Usage
1010
-----
1111
>>> import fundamentals_of_data_science as fun
12-
>>> df = fun.datasets.example()
12+
>>> df = fun.datasets.imports_85()
1313
>>> df.head()
1414
"""
1515
filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'imports-85.data.csv'))
16-
return(pd.read_csv(filename))
16+
return(pd.read_csv(filename))
17+
18+
19+
def kc_house_data():
20+
"""
21+
Returns the kc_house_data dataset.
22+
23+
Usage
24+
-----
25+
>>> import fundamentals_of_data_science as fun
26+
>>> df = fun.datasets.kc_house_data()
27+
>>> df.head()
28+
"""
29+
filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'kc_house_data.csv'))
30+
return(pd.read_csv(filename))
31+
32+
33+
def arsenic():
34+
"""
35+
Returns the arsenic dataset.
36+
37+
Usage
38+
-----
39+
>>> import fundamentals_of_data_science as fun
40+
>>> df = fun.datasets.arsenic()
41+
>>> df.head()
42+
"""
43+
filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'arsenic.wells.tsv'))
44+
return(pd.read_csv(filename, delimeter="\t"))
45+
46+
47+
def child_iq():
48+
"""
49+
Returns the child_iq dataset.
50+
51+
Usage
52+
-----
53+
>>> import fundamentals_of_data_science as fun
54+
>>> df = fun.datasets.child_iq()
55+
>>> df.head()
56+
"""
57+
filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'child_iq.tsv'))
58+
return(pd.read_csv(filename, delimeter="\t"))
59+
60+
61+
def mesquite():
62+
"""
63+
Returns the mesquite dataset.
64+
65+
Usage
66+
-----
67+
>>> import fundamentals_of_data_science as fun
68+
>>> df = fun.datasets.mesquite()
69+
>>> df.head()
70+
"""
71+
filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'mesquite.tsv'))
72+
return(pd.read_csv(filename, delimeter="\t"))

0 commit comments

Comments
 (0)