Skip to content

Commit 7d809da

Browse files
authored
Upload M1L7 Data Challenge
1 parent 64313e6 commit 7d809da

File tree

1 file changed

+221
-0
lines changed

1 file changed

+221
-0
lines changed
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# M1L7 Data Challenge: Data Manipulation \n",
8+
"\n",
9+
" We'll continue to work with UFO sighting data.\n",
10+
"\n",
11+
"### **Dataset:** [UFO Sightings](https://www.kaggle.com/datasets/jonwright13/ufo-sightings-around-the-world-better?resource=download) -- This is also in your data folder \n",
12+
"\n",
13+
"### **Objectives:**\n",
14+
"\n",
15+
"- Use string methods to manipulate data \n",
16+
"- Filter Data \n",
17+
"- Work more with dates in Python\n",
18+
"\n",
19+
"\n",
20+
"\n",
21+
"**Let's get started!**"
22+
]
23+
},
24+
{
25+
"cell_type": "markdown",
26+
"metadata": {},
27+
"source": [
28+
"### Step 1: Import Pandas & Numpy"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"metadata": {},
35+
"outputs": [],
36+
"source": [
37+
"# Import Pandas \n",
38+
"None"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"### Step 2: Load the dataset (csv file stored in the data folder) into a Pandas DataFrame called `ufo`\n",
46+
"\n",
47+
"- The file is callled `ufo-sightings.csv`\n"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
56+
"ufo = None\n"
57+
]
58+
},
59+
{
60+
"cell_type": "markdown",
61+
"metadata": {},
62+
"source": [
63+
"### Step 3: Explore the Data\n",
64+
"\n",
65+
"Use any method(s) of your choice to look at the data and explore it \n"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"None"
75+
]
76+
},
77+
{
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"### Step 4: Clean the UFO_shape column \n",
82+
"- Make the column all uppercase \n",
83+
"- Strip off any leading and trailing spaces \n",
84+
"\n",
85+
"Even if there are no actual spaces; it is still good practice to trim off spaces even if you can't see space with the naked eye\n",
86+
"\n",
87+
"Hint: You will use both `str.upper()` and `str.strip()` -- you can do it in one step or two separate steps "
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": null,
93+
"metadata": {},
94+
"outputs": [],
95+
"source": [
96+
"None"
97+
]
98+
},
99+
{
100+
"cell_type": "markdown",
101+
"metadata": {},
102+
"source": [
103+
"### Step 5: Use `pd.crosstab` to sum the number of shapes seen by season\n",
104+
"\n",
105+
"- Add a comment of a main takeaway from the output "
106+
]
107+
},
108+
{
109+
"cell_type": "code",
110+
"execution_count": null,
111+
"metadata": {},
112+
"outputs": [],
113+
"source": [
114+
"None\n",
115+
"#Add comment here: "
116+
]
117+
},
118+
{
119+
"cell_type": "code",
120+
"execution_count": null,
121+
"metadata": {},
122+
"outputs": [],
123+
"source": [
124+
"# Run this cell without changes before moving on to step 6!\n",
125+
"\n",
126+
"ufo['Date_time'] = pd.to_datetime(ufo['Date_time'], format=\"%Y-%m-%d %H:%M:%S\")"
127+
]
128+
},
129+
{
130+
"cell_type": "markdown",
131+
"metadata": {},
132+
"source": [
133+
"### Step 6: Filter the data where the region is equal to `New York`"
134+
]
135+
},
136+
{
137+
"cell_type": "code",
138+
"execution_count": null,
139+
"metadata": {},
140+
"outputs": [],
141+
"source": [
142+
"None"
143+
]
144+
},
145+
{
146+
"cell_type": "markdown",
147+
"metadata": {},
148+
"source": [
149+
"### Step 7: Get the most recent `Date_time` that a UFO was sighted in New York \n",
150+
"\n",
151+
"Hint: Make sure you saved your filtered data from Step 6 to a new dataframe object aka varaible. You can use `.max()` right after a column name to get the max of that column\n",
152+
"\n",
153+
"You are using the `Date_time` column for this question"
154+
]
155+
},
156+
{
157+
"cell_type": "code",
158+
"execution_count": null,
159+
"metadata": {},
160+
"outputs": [],
161+
"source": [
162+
"None"
163+
]
164+
},
165+
{
166+
"cell_type": "markdown",
167+
"metadata": {},
168+
"source": [
169+
"## Above and Beyond (AAB) -- OPTIONAL\n",
170+
"\n",
171+
"### Question 1: How many days have passed between the first UFO sighting in NY and the most recent sighting in NY based on this data?"
172+
]
173+
},
174+
{
175+
"cell_type": "code",
176+
"execution_count": null,
177+
"metadata": {},
178+
"outputs": [],
179+
"source": [
180+
"None"
181+
]
182+
},
183+
{
184+
"cell_type": "markdown",
185+
"metadata": {},
186+
"source": [
187+
"### Question 2: Filter the data where UFO_shape is `UNKNOWN` and the Region is `New York` "
188+
]
189+
},
190+
{
191+
"cell_type": "code",
192+
"execution_count": null,
193+
"metadata": {},
194+
"outputs": [],
195+
"source": [
196+
"None"
197+
]
198+
}
199+
],
200+
"metadata": {
201+
"kernelspec": {
202+
"display_name": "Python (learn-env)",
203+
"language": "python",
204+
"name": "learn-env"
205+
},
206+
"language_info": {
207+
"codemirror_mode": {
208+
"name": "ipython",
209+
"version": 3
210+
},
211+
"file_extension": ".py",
212+
"mimetype": "text/x-python",
213+
"name": "python",
214+
"nbconvert_exporter": "python",
215+
"pygments_lexer": "ipython3",
216+
"version": "3.12.4"
217+
}
218+
},
219+
"nbformat": 4,
220+
"nbformat_minor": 2
221+
}

0 commit comments

Comments
 (0)