The following data was taken from the National UFO Reporting Center http://www.nuforc.org/ and represents 5 months of reported UFO sightings from January 2016 to May 2016.
Let's Perform a data analysis on 3 months of data by answering the questions below
In [1]:
import pandas as pd
jan_ufo = pd.read_csv('https://raw.githubusercontent.com/mafudge/datasets/master/ufo-sightings/ufo-sightings-2016-01.csv')
jan_ufo.head()
Out[1]:
Date / Time
City
State
Shape
Duration
Summary
Posted
0
1/31/16 23:10
Stanton
TX
Triangle
4 seconds
Flying Triangle object Martin County, TX.
2/4/2016
1
1/31/16 23:00
Emigrant Pass (near; foothills of)
OR
Other
NaN
Seen a object with a solid orange bar that lit...
2/4/2016
2
1/31/16 22:00
Allentown
PA
Fireball
4 seconds
Yellow beam of light falling from the sky, wit...
2/4/2016
3
1/31/16 20:57
Sandpoint
ID
Fireball
90 seconds
Object came in from west to east below approx ...
2/4/2016
4
1/31/16 20:46
West Suffield
CT
Circle
~2 minutes
I saw 3 orange lights in a formation coming to...
2/4/2016
In [2]:
# in this cell write code toread in the sightings from feb (2016-01) and march (2016-02) into variables
feb_ufo = pd.read_csv('https://raw.githubusercontent.com/mafudge/datasets/master/ufo-sightings/ufo-sightings-2016-02.csv')
mar_ufo = pd.read_csv('https://raw.githubusercontent.com/mafudge/datasets/master/ufo-sightings/ufo-sightings-2016-03.csv')
In [3]:
# next combine all three dataframes into a single dataframe, UFO. Here's the docs:
# http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.append.html
# if you ufo.count() you should see 1229 rows.
ufo = jan_ufo.append(feb_ufo).append(mar_ufo)
ufo.count()
Out[3]:
Date / Time 1229
City 1229
State 1190
Shape 1197
Duration 1186
Summary 1229
Posted 1229
dtype: int64
Let's answer some questions!
In [4]:
# get a summary of sightings by state
ufo['State'].value_counts()
Out[4]:
CA 139
FL 86
AZ 71
PA 52
WA 50
NC 49
NY 48
CO 48
OR 39
VA 34
TX 32
MD 32
MO 28
TN 26
IL 26
NJ 24
NM 24
OH 23
SC 22
CT 21
MI 19
WI 18
MN 18
AK 16
MA 15
ME 13
NH 13
NV 12
UT 12
GA 12
AL 12
ID 11
KS 11
LA 11
IN 11
KY 10
AR 9
ON 9
HI 8
IA 8
BC 8
VT 7
MT 7
OK 7
WV 6
AB 5
RI 4
DE 3
SD 3
NE 3
ND 3
WY 2
DC 2
MS 2
NB 2
NT 1
MB 1
NS 1
SK 1
Name: State, dtype: int64
In [9]:
# are there any Allentown, PA sightings? List them.
ufo [ (ufo['City'] =='Allentown') & (ufo['State']=='PA') ]
Out[9]:
Date / Time
City
State
Shape
Duration
Summary
Posted
2
1/31/16 22:00
Allentown
PA
Fireball
4 seconds
Yellow beam of light falling from the sky, wit...
2/4/2016
320
2/8/16 21:00
Allentown
PA
Sphere
~3 minutes
2 twin spheres of orange light encircle airpor...
2/11/2016
In [5]:
# list sightings have "orange" in the summary. We use .str.find to locate the word orange" somewhere in the summary
orange = ufo[ ufo['Summary'].str.find('orange')>=0 ]
orange
Out[5]:
Date / Time
City
State
Shape
Duration
Summary
Posted
1
1/31/16 23:00
Emigrant Pass (near; foothills of)
OR
Other
NaN
Seen a object with a solid orange bar that lit...
2/4/2016
4
1/31/16 20:46
West Suffield
CT
Circle
~2 minutes
I saw 3 orange lights in a formation coming to...
2/4/2016
5
1/31/16 20:45
West Suffield
CT
Circle
2 minutes
When letting my dog out approx 8:45pm I was ch...
2/4/2016
10
1/31/16 15:00
Baltimore
MD
Triangle
NaN
https://www.youtube.com/watch?v=Gq-yIuNsRtk ((...
2/4/2016
16
1/30/16 21:00
Hopkins
MN
Formation
3 minutes
Mulitple points of orange-colored lights movin...
2/4/2016
17
1/30/16 20:00
Middleburg
FL
Sphere
6 minutess
Seven orange lights fly over SW Jacksonville
2/4/2016
35
1/29/16 21:00
Orono
MN
Light
3 minutes
18-20 orange light spheres moving SW to NE. Si...
2/11/2016
49
1/28/16 22:49
La Luz
NM
Light
3 minutes
Yellowish/orange sphere seen by 3 witness in A...
1/29/2016
51
1/28/16 21:00
Tome
NM
Light
30 minutes
I'm constantly seeing orange lights hovering o...
1/29/2016
52
1/28/16 20:40
Waukee
IA
Fireball
5 minutes
Large orange fireball moved across the sky fro...
1/29/2016
54
1/28/16 20:15
Ayer/Harvard
MA
Sphere
NaN
3 reddish/orange orbs over rte 2 in Ayer, MA.
2/4/2016
56
1/28/16 19:00
Portland
OR
Circle
NaN
Saw three orange circles near each other and t...
1/29/2016
57
1/28/16 15:30
Rowlett
TX
Other
~2 minutes
I saw what looked like an airplane with a larg...
2/4/2016
69
1/27/16 17:33
Florence
CO
Circle
5 seconds
Yellow/orange sphere hovering 20' off the grou...
4/1/2016
81
1/25/16 20:20
New Braunfels
TX
Light
7 minutes
On my porch facing southwest I saw an orange l...
1/29/2016
94
1/24/16 21:30
Lakveville
MN
Fireball
2 minutes
Two orange glows in the sky going fast an low ...
1/29/2016
96
1/24/16 18:45
Huntingdon
TN
Formation
2 minutes
There were three reddish orange lights, then a...
1/29/2016
97
1/24/16 18:43
Montevallo
AL
Light
45 seconds
We were heading towards W, when I look into th...
1/29/2016
101
1/24/16 17:40
Sterling
IL
Light
5 minutes
20 pulsing orange orbs fly a few miles before ...
1/29/2016
103
1/24/16 04:30
Reno
NV
Circle
75 minutes
4-5 UFO's (orange lights) circled around a bob...
2/11/2016
106
1/23/16 23:45
Azusa
CA
Triangle
1 minute
8 bright yellow red and orange triangular obje...
1/29/2016
107
1/23/16 22:30
Council Grove
KS
Light
1 minute
Red orange light hovered in the sky in front o...
1/29/2016
108
1/23/16 21:20
Long Beach
CA
Circle
5 minutes
Large bright orange circle, rapidly ascending ...
1/29/2016
110
1/23/16 20:15
Huntington
TX
Light
5-8 minutes
Seven orange lights moving slowly at low altit...
1/29/2016
114
1/23/16 18:25
Franklin
TN
Fireball
3 minutes
2 orange balls of light approaching from the W...
1/29/2016
128
1/21/16 23:30
Burbank
CA
Sphere
1-2 minutes
Large bright orange sphere, rapidly descending...
1/23/2016
133
1/21/16 21:00
Skokie
IL
Sphere
Still
I notice everyone stopping their car to take p...
1/23/2016
150
1/19/16 06:25
Little Chute
WI
Oval
1 minute
Distinct orange oval globes seen twice south o...
2/4/2016
159
1/18/16 20:30
Heber City
UT
Formation
3 minutes
Five oranges lights in a formation slowly movi...
1/20/2016
162
1/18/16 16:00
Hillsboro
ND
Circle
5 minutes
7 or 8 bright round, or cylinder shaped, orang...
1/20/2016
...
...
...
...
...
...
...
...
98
3/23/16 21:58
Pawleys Island
SC
Light
4 seconds
4 orange lights over ocean for 4 seconds.
3/24/2016
127
3/21/16 02:08
Bowling Green
KY
Light
1 hour-ongoing
2 orange-red star like light hovering subtle m...
3/24/2016
135
3/20/16 01:26
Albuquerque
NM
Light
2:00 minutes
Two orange orbs heading east over Albuquerque ...
3/24/2016
142
3/19/16 06:30
Colorado Springs
CO
Changing
32 minutes
Thin light accompanied with 2 orange orbs,Colo...
4/1/2016
151
3/18/16 20:30
Felton
DE
Circle
4 minutes
One bright round white light changed to two or...
3/24/2016
170
3/17/16 20:34
Goshen
IN
Circle
90 seconds
Saw 12 to 15 yellowish orange circles flying a...
3/18/2016
174
3/17/16 06:05
Marshall
MO
Other
10 seconds
Two crafts with numerous orange lights.
3/18/2016
205
3/15/16 02:30
Deland
FL
Cross
5-7 minutes
I was on the backside of Blue Lake looking at ...
3/24/2016
213
3/14/16 13:01
Orlando
FL
Cigar
10 seconds
Looking East over Hiawassee Road I saw a brigh...
3/18/2016
221
3/13/16 21:00
Los Fresnos
TX
Light
15 minutes
14 orange lights seen traveling the same path ...
3/18/2016
225
3/12/16 23:55
Ft. Pierce
FL
Circle
10 seconds
Reddish/orange circular, hazy, glowing, light ...
3/18/2016
233
3/12/16 19:45
West Palm Beach
FL
Disk
30 seconds
Two crafts with orange pulsating glow coming f...
3/18/2016
247
3/11/16 20:45
Springfield
VA
Circle
1 minutes
Four orange lights over Springfield, VA.
3/18/2016
263
3/11/16 00:35
East Greenwich
RI
Disk
15 minutes
I followed a bright orange light as I was driv...
3/18/2016
265
3/10/16 21:00
Oshkosh
WI
Other
10 minutes
Strobe lights surrounding orange craft.
3/11/2016
268
3/10/16 19:00
Bayonne
NJ
Diamond
NaN
Just seen a bright orange diamond shape star m...
3/11/2016
275
3/9/16 19:05
Marysville
WA
Unknown
3 minutes
Observed orange light in night sky no other li...
3/18/2016
294
3/8/16 03:00
Chatsworth
GA
Circle
10 minutes
Whitish green object spotted in the sky, sudde...
3/11/2016
305
3/7/16 01:52
Kill Devil Hills
NC
Light
6 minutes
Bright orange, round light.
3/11/2016
337
3/4/16 19:00
Merritt Island
FL
Sphere
1.5 minutes
Nine orange glowing orbs following same genera...
3/18/2016
340
3/4/16 18:15
Fairlee
VT
Oval
5 minutes
Three pairs of two bright orange discs low in ...
3/11/2016
347
3/3/16 22:30
Gosport (to Fareham) (UK/England)
NaN
NaN
NaN
Saw a bright yellow/orange bright light at app...
6/1/2016
349
3/3/16 20:30
West Topsham
VT
Changing
10 minutes
Several orange lights flying separately and in...
3/4/2016
350
3/3/16 20:30
West Topsham
VT
Changing
10 minutes
Several orange lights moving in odd and changi...
3/11/2016
352
3/3/16 20:00
LaVeta
CO
Other
1 hour
USAF craft chasing lights. Pattern of orange f...
3/4/2016
363
3/2/16 21:15
Harrisburg
PA
Light
3 minutes
Two orange light, seen heading toward the rive...
3/4/2016
371
3/2/16 19:39
UK/England (offshore oil rig)
NaN
Formation
1 minute
Multiple triangular orange light formations ov...
3/11/2016
386
3/1/16 20:10
California
MO
Formation
8 seconds
As I crested a hill on highway 87 south, about...
3/4/2016
387
3/1/16 19:00
Parker
AZ
Light
45 seconds
Two orange lights with one white light between...
5/6/2016
394
3/1/16 05:57
Las Vegas
NV
Fireball
2-3 seconds
Driving down Decatur Sahara. Right in front of...
3/4/2016
145 rows × 7 columns
In [18]:
# finally write a program to ask for a search term such as "orange" or "formation" and then returns the sightings
# with that term in the summary
print("Welecome to UFO World... You are not alone!")
search = input("Enter Search Term: ")
results = ufo[ ufo['Summary'].str.find(search)>=0 ]
results
UFO World... You are not alone!
Enter Search Term: sphere
Out[18]:
Date / Time
City
State
Shape
Duration
Summary
Posted
6
1/31/16 20:30
Big Lake
AK
Circle
10 seconds
Orange circle with a rotating sphere on the to...
2/4/2016
35
1/29/16 21:00
Orono
MN
Light
3 minutes
18-20 orange light spheres moving SW to NE. Si...
2/11/2016
49
1/28/16 22:49
La Luz
NM
Light
3 minutes
Yellowish/orange sphere seen by 3 witness in A...
1/29/2016
69
1/27/16 17:33
Florence
CO
Circle
5 seconds
Yellow/orange sphere hovering 20' off the grou...
4/1/2016
128
1/21/16 23:30
Burbank
CA
Sphere
1-2 minutes
Large bright orange sphere, rapidly descending...
1/23/2016
133
1/21/16 21:00
Skokie
IL
Sphere
Still
I notice everyone stopping their car to take p...
1/23/2016
172
1/16/16 22:00
Amery/Star Prairie
WI
Other
NaN
Saw big white lights, scattered 100 miles appa...
1/23/2016
204
1/14/16 18:25
Antioch
IL
Sphere
10 minutes
Seen in the E sky heading N at least 50 or mor...
1/20/2016
205
1/14/16 18:20
Antioch
IL
Sphere
3 minutes
Formation of orange spheres in sky.
1/20/2016
215
1/13/16 22:15
Cedar Falls
IA
Fireball
10 minutes
Red/Orange sphere seen descending over Cedar F...
1/14/2016
234
1/12/16 20:30
Lake Havasu City
AZ
Sphere
3 minutes
Bright, moving fast orange sphere over Lake Ha...
1/14/2016
277
1/7/16 20:00
Unity
PA
Fireball
3 minutes
Yellowish/orange sphere seen over town of Mutu...
1/14/2016
278
1/7/16 17:15
Candler
NC
Sphere
10 minutes
Cluster of black spheres seen over Candler, NC.
1/8/2016
342
1/3/16 18:15
Santee
CA
Fireball
2 second
Wife and I facing N, fluorescent green streak ...
1/5/2016
350
1/2/16 22:00
Gallatin
TN
Triangle
NaN
I came outside to smoke a cigarette around 10p...
1/5/2016
381
1/1/16 05:30
Medford
NY
Circle
2 minutes
Bright orange sphere in sky traveling N to E. ...
1/5/2016
409
1/1/16
Vernon
CT
Sphere
10 minutes
Red sphere in the sky.
1/5/2016
57
2/27/16 06:00
Creede
CO
Sphere
2 minutes
Two spheres, bright as Jupiter, then faded aft...
3/4/2016
81
2/25/16 04:15
Clements
AL
Circle
5 seconds
White sphere.
2/26/2016
142
2/19/16 19:45
Pueblo
CO
Sphere
1 minute
Group of 6-7 red-orange spheres, moving indepe...
2/26/2016
205
2/14/16 20:48
Woodbridge
VA
Sphere
8 minutes
Orange orbs or spheres, flying in formation so...
2/19/2016
307
2/9/16 21:00
Laredo
TX
Sphere
non stop
Last night, I was at my back yard and while in...
2/11/2016
316
2/9/16 00:45
Delta/Tsawwassen (Canada)
BC
Sphere
5-10 seconds
Blue-green sphere appears over the ocean, hove...
2/19/2016
320
2/8/16 21:00
Allentown
PA
Sphere
~3 minutes
2 twin spheres of orange light encircle airpor...
2/11/2016
335
2/7/16 11:50
Palm Beach Gardens
FL
Other
45 seconds
Three sphere-shaped UFO's were seen high up in...
2/11/2016
338
2/7/16 05:52
Culpeper
VA
Sphere
3-5 minutes
Two spheres move in unusual ways in early morn...
2/11/2016
380
2/4/16 19:30
Tucson
AZ
Sphere
20 minutes
Eight large, slow moving, noiseless orange-red...
2/19/2016
404
2/2/16 15:00
Raleigh
NC
Sphere
5-10 seconds
Very shiny sphere-like object in the sky dropp...
2/11/2016
410
2/1/16 21:55
Charleston
SC
Sphere
1 minute
Bright red light sphere moving silently and ve...
2/4/2016
17
3/30/16 00:30
Maywood
CA
Circle
1 hour
((HOAX??)) Object flying over atmosphere blink...
4/1/2016
45
3/28/16 12:30
Tucson
AZ
Light
60 seconds
Light sphere becomes hawk.
4/1/2016
82
3/25/16 22:00
Kirkland/Kenmore
WA
Sphere
14 minutes
15-20 orange spheres floating in triangular pa...
4/1/2016
95
3/23/16 23:00
Meadow Creek
KY
Sphere
20 minutes
9 red-orange spheres witnessed by two people f...
3/24/2016
119
3/21/16 23:15
Hampton
VA
Sphere
5 minutes
Stationery green sphere changed to red and beg...
3/24/2016
173
3/17/16 19:28
Zephyrhills
FL
Fireball
25 seconds
Watched a fireball enter the atmosphere then c...
3/18/2016
175
3/17/16 05:30
Pine Grove
CA
Sphere
10 minutes
Yard was lit up and a huge blinding bright lig...
4/1/2016
331
3/5/16 17:45
Pasco County
FL
Oval
:45
Blue-green sphere seen at 8:00 position from t...
3/11/2016
378
3/2/16 01:00
Boynton Beach
FL
Sphere
NaN
Red and white lights sphere figure stayed in t...
3/4/2016
In [ ]:
Content source: IST256/learn-python
Similar notebooks: