Skip to content

Commit 5d1be52

Browse files
committed
feat(datasets): load problems 197, 577, 1148, 1683
1 parent f40f5b7 commit 5d1be52

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

problems/datasets.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,37 @@
33
import pandas as pd
44

55

6+
def load_problem_197() -> pd.DataFrame:
7+
data = [
8+
[1, "2015-01-01", 10],
9+
[2, "2015-01-02", 25],
10+
[3, "2015-01-03", 20],
11+
[4, "2015-01-04", 30],
12+
]
13+
return pd.DataFrame(data, columns=["id", "recordDate", "temperature"]).astype(
14+
{"id": "Int64", "recordDate": "datetime64[ns]", "temperature": "Int64"}
15+
)
16+
17+
18+
def load_problem_577() -> tuple:
19+
data = [
20+
[3, "Brad", None, 4000],
21+
[1, "John", 3, 1000],
22+
[2, "Dan", 3, 2000],
23+
[4, "Thomas", 3, 4000],
24+
]
25+
employee = pd.DataFrame(
26+
data, columns=["empId", "name", "supervisor", "salary"]
27+
).astype(
28+
{"empId": "Int64", "name": "object", "supervisor": "Int64", "salary": "Int64"}
29+
)
30+
data = [[2, 500], [4, 2000]]
31+
bonus = pd.DataFrame(data, columns=["empId", "bonus"]).astype(
32+
{"empId": "Int64", "bonus": "Int64"}
33+
)
34+
return employee, bonus
35+
36+
637
def load_problem_584() -> pd.DataFrame:
738
data = [
839
[1, "Will", None],
@@ -38,6 +69,28 @@ def load_problem_595() -> pd.DataFrame:
3869
)
3970

4071

72+
def load_problem_1148() -> pd.DataFrame:
73+
data = [
74+
[1, 3, 5, "2019-08-01"],
75+
[1, 3, 6, "2019-08-02"],
76+
[2, 7, 7, "2019-08-01"],
77+
[2, 7, 6, "2019-08-02"],
78+
[4, 7, 1, "2019-07-22"],
79+
[3, 4, 4, "2019-07-21"],
80+
[3, 4, 4, "2019-07-21"],
81+
]
82+
return pd.DataFrame(
83+
data, columns=["article_id", "author_id", "viewer_id", "view_date"]
84+
).astype(
85+
{
86+
"article_id": "Int64",
87+
"author_id": "Int64",
88+
"viewer_id": "Int64",
89+
"view_date": "datetime64[ns]",
90+
}
91+
)
92+
93+
4194
def load_problem_1378() -> tuple():
4295
data = [[1, "Alice"], [7, "Bob"], [11, "Meir"], [90, "Winston"], [3, "Jonathan"]]
4396
employees = pd.DataFrame(data, columns=["id", "name"]).astype(
@@ -80,6 +133,13 @@ def load_problem_1517() -> pd.DataFrame:
80133
)
81134

82135

136+
def load_problem_1683() -> pd.DataFrame:
137+
data = [[1, "Let us Code"], [2, "More than fifteen chars are here!"]]
138+
return pd.DataFrame(data, columns=["tweet_id", "content"]).astype(
139+
{"tweet_id": "Int64", "content": "object"}
140+
)
141+
142+
83143
def load_problem_1757() -> pd.DataFrame:
84144
data = [
85145
["0", "Y", "N"],

0 commit comments

Comments
 (0)