In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
In [2]:
# Economic performance data -- epd
epd = pd.read_csv('economic_performance.csv')
epd.describe()
Out[2]:
Data
count
1.178300e+04
mean
3.391635e+08
std
4.206478e+09
min
2.800000e-02
25%
8.493000e+01
50%
1.311190e+05
75%
1.752482e+06
max
1.110910e+11
In [3]:
epd.describe(include='all')
Out[3]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
count
11783
11783
11783
1.178300e+04
11783
11783
11735
11350
11735
11350
unique
44
4
593
NaN
3
8914
8881
8617
980
1039
top
Unemployment Rate
integer
Sep-2012
NaN
Monthly
4.3%
4.3%
4.1%
0%
3%
freq
1364
5237
32
NaN
10857
36
36
36
1357
555
mean
NaN
NaN
NaN
3.391635e+08
NaN
NaN
NaN
NaN
NaN
NaN
std
NaN
NaN
NaN
4.206478e+09
NaN
NaN
NaN
NaN
NaN
NaN
min
NaN
NaN
NaN
2.800000e-02
NaN
NaN
NaN
NaN
NaN
NaN
25%
NaN
NaN
NaN
8.493000e+01
NaN
NaN
NaN
NaN
NaN
NaN
50%
NaN
NaN
NaN
1.311190e+05
NaN
NaN
NaN
NaN
NaN
NaN
75%
NaN
NaN
NaN
1.752482e+06
NaN
NaN
NaN
NaN
NaN
NaN
max
NaN
NaN
NaN
1.110910e+11
NaN
NaN
NaN
NaN
NaN
NaN
In [4]:
names = epd['Name'].unique(); names
Out[4]:
array(['Population (Demographer)', 'Taxable Retail Sales',
'Gross Domestic Product', 'Personal Income',
'Per Capita Personal Income', 'Labor Force', 'Employment',
'Unemployment', 'Unemployment Rate', 'Total Nonfarm Employment',
'Private Employment', 'Government Employment',
'Average Weekly Hours Worked - Private',
'Average Weekly Wages - Private', 'Private Establishments',
'Industrial Market Avg. Asking Rents PSF',
'Industrial Market Vacancy Rate',
'Office Market Avg. Asking Rents PSF',
'Office Market Vacancy Rate',
'Retail Market Avg. Asking Rents PSF',
'Retail Market Vacancy Rate', 'New Commercial Buildings Permitted',
'Value of New Commercial Buildings Permitted',
'Cost of Living Index', 'Gross Casino Gaming Revenue',
'Hotel Room Inventory', 'Hotel/Motel Occupancy Rate',
'Average Daily Room Rate', 'Visitor Volume',
'McCarran International Airport Passengers',
'Gallons of Gasoline Sold', 'New Home Closings',
'New Home Median Closing Price', 'New Residential Units Permitted',
'Value of New Residential Units Permitted',
'Existing Home Median Closing Price', 'Existing Home Closings',
'MLS Listings', 'Apartment Market Average Asking Rents',
'Apartment Market Vacancy Rate', 'Apartment Market Occupancy Rate',
'Drivers License Surrenders', 'Electric Meter Hookups',
'Total Enrollment'], dtype=object)
In [5]:
population = pd.read_csv('nevada_population.csv'); population.head()
Out[5]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
0
Population
integer
1900
43000.0
Annually
43,000
NaN
NaN
NaN
NaN
1
Population
integer
1901
45000.0
Annually
45,000
43,000
43,000
5%
5%
2
Population
integer
1902
49000.0
Annually
49,000
45,000
45,000
9%
9%
3
Population
integer
1903
52000.0
Annually
52,000
49,000
49,000
6%
6%
4
Population
integer
1904
56000.0
Annually
56,000
52,000
52,000
8%
8%
In [6]:
population.tail()
Out[6]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
113
Population
integer
2013
2786547.0
Annually
2,786,547
2,752,410
2,752,410
1%
1%
114
Population
integer
2014
2831730.0
Annually
2,831,730
2,786,547
2,786,547
2%
2%
115
Population
integer
2015
2883057.0
Annually
2,883,057
2,831,730
2,831,730
2%
2%
116
Population
integer
2016
2939254.0
Annually
2,939,254
2,883,057
2,883,057
2%
2%
117
Population
integer
2017
2998039.0
Annually
2,998,039
2,939,254
2,939,254
2%
2%
In [7]:
population.shape
Out[7]:
(118, 10)
In [8]:
population.describe()
Out[8]:
Date
Data
count
118.000000
1.180000e+02
mean
1958.500000
7.460691e+05
std
34.207699
8.964108e+05
min
1900.000000
4.300000e+04
25%
1929.250000
9.050000e+04
50%
1958.500000
2.740000e+05
75%
1987.750000
1.062110e+06
max
2017.000000
2.998039e+06
In [9]:
population.describe(include='all')
Out[9]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
count
118
118
118.000000
1.180000e+02
118
118
117
117
117
117
unique
1
1
NaN
NaN
1
107
106
106
19
19
top
Population
integer
NaN
NaN
Annually
82,000
82,000
82,000
4%
4%
freq
118
118
NaN
NaN
118
5
5
5
20
20
mean
NaN
NaN
1958.500000
7.460691e+05
NaN
NaN
NaN
NaN
NaN
NaN
std
NaN
NaN
34.207699
8.964108e+05
NaN
NaN
NaN
NaN
NaN
NaN
min
NaN
NaN
1900.000000
4.300000e+04
NaN
NaN
NaN
NaN
NaN
NaN
25%
NaN
NaN
1929.250000
9.050000e+04
NaN
NaN
NaN
NaN
NaN
NaN
50%
NaN
NaN
1958.500000
2.740000e+05
NaN
NaN
NaN
NaN
NaN
NaN
75%
NaN
NaN
1987.750000
1.062110e+06
NaN
NaN
NaN
NaN
NaN
NaN
max
NaN
NaN
2017.000000
2.998039e+06
NaN
NaN
NaN
NaN
NaN
NaN
In [10]:
dates = range(1900,2018)
plt.plot(dates, population['Data'])
plt.title('Nevada Population Growth 1900-2017')
plt.show()
In [11]:
# Per Capita Personal Income -- pcpi
pcpi = pd.read_csv('personal_income.csv'); pcpi.head()
Out[11]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
0
Per Capita Personal Income
currency
1929
874.0
Annually
$874
NaN
NaN
NaN
NaN
1
Per Capita Personal Income
currency
1930
834.0
Annually
$834
$874
$874
-5%
-5%
2
Per Capita Personal Income
currency
1931
665.0
Annually
$665
$834
$834
-20%
-20%
3
Per Capita Personal Income
currency
1932
557.0
Annually
$557
$665
$665
-16%
-16%
4
Per Capita Personal Income
currency
1933
499.0
Annually
$499
$557
$557
-10%
-10%
In [12]:
pcpi.describe(include='all')
Out[12]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
count
89
89
89.000000
89.000000
89
89
88
88
88
88
unique
1
1
NaN
NaN
1
89
88
88
28
28
top
Per Capita Personal Income
currency
NaN
NaN
Annually
$7,225
$7,225
$7,225
3%
3%
freq
89
89
NaN
NaN
89
1
1
1
10
10
mean
NaN
NaN
1973.000000
14011.348315
NaN
NaN
NaN
NaN
NaN
NaN
std
NaN
NaN
25.836021
14465.977545
NaN
NaN
NaN
NaN
NaN
NaN
min
NaN
NaN
1929.000000
499.000000
NaN
NaN
NaN
NaN
NaN
NaN
25%
NaN
NaN
1951.000000
2288.000000
NaN
NaN
NaN
NaN
NaN
NaN
50%
NaN
NaN
1973.000000
6296.000000
NaN
NaN
NaN
NaN
NaN
NaN
75%
NaN
NaN
1995.000000
25346.000000
NaN
NaN
NaN
NaN
NaN
NaN
max
NaN
NaN
2017.000000
44626.000000
NaN
NaN
NaN
NaN
NaN
NaN
In [13]:
pcpi.shape
Out[13]:
(89, 10)
In [14]:
# Make sure that the dataframes have the same shape for plotting
rs_pop = population[29:]; rs_pop.shape
Out[14]:
(89, 10)
In [15]:
dates = range(1929,2018)
# plt.plot(dates, rs_pop['Data'])
plt.plot(dates, pcpi['Data'])
plt.title('Nevada Per Capita Personal Income 1929-2017')
plt.show()
In [16]:
# Airport Passengers All Airports -- apaa
apaa = pd.read_csv('airport_passengers.csv'); apaa.describe(include='all')
Out[16]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
count
159
159
159
1.590000e+02
159
159
158
147
158
147
unique
1
1
159
NaN
1
159
158
147
31
25
top
Airport Passengers
integer
Dec-2013
NaN
Monthly
3,846,771
3,846,771
3,846,771
-1%
2%
freq
159
159
1
NaN
159
1
1
1
24
18
mean
NaN
NaN
NaN
4.035191e+06
NaN
NaN
NaN
NaN
NaN
NaN
std
NaN
NaN
NaN
3.746676e+05
NaN
NaN
NaN
NaN
NaN
NaN
min
NaN
NaN
NaN
3.184564e+06
NaN
NaN
NaN
NaN
NaN
NaN
25%
NaN
NaN
NaN
3.800626e+06
NaN
NaN
NaN
NaN
NaN
NaN
50%
NaN
NaN
NaN
4.025903e+06
NaN
NaN
NaN
NaN
NaN
NaN
75%
NaN
NaN
NaN
4.335499e+06
NaN
NaN
NaN
NaN
NaN
NaN
max
NaN
NaN
NaN
4.822538e+06
NaN
NaN
NaN
NaN
NaN
NaN
In [17]:
apaa.head()
Out[17]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
0
Airport Passengers
integer
Jul-2004
4257745.0
Monthly
4,257,745
NaN
NaN
NaN
NaN
1
Airport Passengers
integer
Aug-2004
4200675.0
Monthly
4,200,675
4,257,745
NaN
-1%
NaN
2
Airport Passengers
integer
Sep-2004
3892548.0
Monthly
3,892,548
4,200,675
NaN
-7%
NaN
3
Airport Passengers
integer
Oct-2004
4148764.0
Monthly
4,148,764
3,892,548
NaN
7%
NaN
4
Airport Passengers
integer
Nov-2004
3843258.0
Monthly
3,843,258
4,148,764
NaN
-7%
NaN
In [18]:
apaa.tail()
Out[18]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
154
Airport Passengers
integer
May-2017
4560853.0
Monthly
4,560,853
4,400,012
4,471,129
4%
2%
155
Airport Passengers
integer
Jun-2017
4595597.0
Monthly
4,595,597
4,560,853
4,502,348
1%
2%
156
Airport Passengers
integer
Jul-2017
4759389.0
Monthly
4,759,389
4,595,597
4,557,434
4%
4%
157
Airport Passengers
integer
Aug-2017
4672230.0
Monthly
4,672,230
4,759,389
4,477,838
-2%
4%
158
Airport Passengers
integer
Sep-2017
4452317.0
Monthly
4,452,317
4,672,230
4,413,895
-5%
1%
In [19]:
dates = (np.arange(0,180,step=12))
plt.plot(apaa['Data'])
plt.xticks(dates,range(4,19))
plt.title("Airport Passenger Counts For All Nevada Airports")
plt.xlabel('Dates range from July 2004 to September 2017')
plt.show()
In [40]:
vv = pd.read_csv('visitor_volume.csv'); vv.head()
Out[40]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
0
Visitor Volume
integer
Oct-1996
3686143.0
Monthly
3,686,143
NaN
NaN
NaN
NaN
1
Visitor Volume
integer
Nov-1996
3302097.0
Monthly
3,302,097
3,686,143
NaN
-10%
NaN
2
Visitor Volume
integer
Dec-1996
3056143.0
Monthly
3,056,143
3,302,097
NaN
-7%
NaN
3
Visitor Volume
integer
Jan-1997
3377731.0
Monthly
3,377,731
3,056,143
NaN
11%
NaN
4
Visitor Volume
integer
Feb-1997
3340058.0
Monthly
3,340,058
3,377,731
NaN
-1%
NaN
In [41]:
vv.describe(include='all')
Out[41]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
count
255
255
255
2.530000e+02
255
255
252
243
252
243
unique
1
1
255
NaN
1
254
252
243
37
32
top
Visitor Volume
integer
Dec-2013
NaN
Monthly
n.a.
4,076,789
4,076,789
1%
1%
freq
255
255
1
NaN
255
2
1
1
20
30
mean
NaN
NaN
NaN
4.224980e+06
NaN
NaN
NaN
NaN
NaN
NaN
std
NaN
NaN
NaN
4.277735e+05
NaN
NaN
NaN
NaN
NaN
NaN
min
NaN
NaN
NaN
3.056143e+06
NaN
NaN
NaN
NaN
NaN
NaN
25%
NaN
NaN
NaN
3.899251e+06
NaN
NaN
NaN
NaN
NaN
NaN
50%
NaN
NaN
NaN
4.260492e+06
NaN
NaN
NaN
NaN
NaN
NaN
75%
NaN
NaN
NaN
4.549456e+06
NaN
NaN
NaN
NaN
NaN
NaN
max
NaN
NaN
NaN
5.240708e+06
NaN
NaN
NaN
NaN
NaN
NaN
In [47]:
plt.plot(vv['Data'])
plt.show()
In [48]:
# Gross Casino Gaming Revenue
gcgr = pd.read_csv('gaming_revenue.csv'); gcgr.head()
Out[48]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
0
Gross Casino Gaming Revenue
currency
Apr-1983
241286383.0
Monthly
$241,286,383
NaN
NaN
NaN
NaN
1
Gross Casino Gaming Revenue
currency
May-1983
243923340.0
Monthly
$243,923,340
$241,286,383
NaN
1%
NaN
2
Gross Casino Gaming Revenue
currency
Jun-1983
238944420.0
Monthly
$238,944,420
$243,923,340
NaN
-2%
NaN
3
Gross Casino Gaming Revenue
currency
Jul-1983
277215594.0
Monthly
$277,215,594
$238,944,420
NaN
16%
NaN
4
Gross Casino Gaming Revenue
currency
Aug-1983
252093854.0
Monthly
$252,093,854
$277,215,594
NaN
-9%
NaN
In [49]:
gcgr.describe(include='all')
Out[49]:
Name
DataType
Date
Data
Period
Current - Latest Period
Current - Prior Period
Current - One Year Ago
Current - Change Vs. Prior Period
Current - Change Vs. One Year Ago
count
422
422
422
4.220000e+02
422
422
421
410
421
410
unique
1
1
422
NaN
1
422
421
410
45
44
top
Gross Casino Gaming Revenue
currency
Dec-2013
NaN
Monthly
$371,380,445
$371,380,445
$371,380,445
-3%
4%
freq
422
422
1
NaN
422
1
1
1
26
25
mean
NaN
NaN
NaN
7.020014e+08
NaN
NaN
NaN
NaN
NaN
NaN
std
NaN
NaN
NaN
2.524294e+08
NaN
NaN
NaN
NaN
NaN
NaN
min
NaN
NaN
NaN
2.178806e+08
NaN
NaN
NaN
NaN
NaN
NaN
25%
NaN
NaN
NaN
4.784285e+08
NaN
NaN
NaN
NaN
NaN
NaN
50%
NaN
NaN
NaN
7.666464e+08
NaN
NaN
NaN
NaN
NaN
NaN
75%
NaN
NaN
NaN
9.102001e+08
NaN
NaN
NaN
NaN
NaN
NaN
max
NaN
NaN
NaN
1.165203e+09
NaN
NaN
NaN
NaN
NaN
NaN
In [46]:
plt.plot(gcgr['Data'])
plt.show()
In [ ]:
Content source: bgroveben/python3_machine_learning_projects
Similar notebooks: