Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
22074847_am2liyanaarac_fvq_spring_2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Akash Manujaya Liyanaarachchi
22074847_am2liyanaarac_fvq_spring_2023
Commits
36716840
Commit
36716840
authored
2 years ago
by
Akash Manujaya Liyanaarachchi
Browse files
Options
Downloads
Patches
Plain Diff
FR6 completed but padding changing with different column sizes
parent
040fdcf5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
UFCFVQ-15-M_Python_Programming_Template.ipynb
+117
-41
117 additions, 41 deletions
UFCFVQ-15-M_Python_Programming_Template.ipynb
with
117 additions
and
41 deletions
UFCFVQ-15-M_Python_Programming_Template.ipynb
+
117
−
41
View file @
36716840
...
...
@@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count":
1
,
"execution_count":
29
,
"metadata": {
"deletable": false
},
...
...
@@ -65,28 +65,21 @@
}
],
"source": [
"def geometric_mean(num
bers
):\n",
"def geometric_mean(num
_lst
):\n",
" \"\"\"\n",
" Calculate the geometric mean of a list of numbers.\n",
"\n",
" Parameters:\n",
" numbers (list): A list of positive integers or floats.\n",
"\n",
" Returns:\n",
" float: The geometric mean of the numbers in the list.\n",
" :param num_lst: A list of positive integers or floats.\n",
" :returns float: The geometric mean of the numbers in the list.\n",
" \"\"\"\n",
" # Initialize the product of the numbers\n",
" product = 1\n",
" # Length of the list\n",
" num_elements = len(numbers)\n",
"\n",
" # Iterate through the list of numbers and multiply each number\n",
" for number in num
bers
:\n",
" for number in num
_lst
:\n",
" product *= number\n",
"\n",
" # Calculate the nth root of the product\n",
" geometric_mean_result = product ** (1 / num_elements)\n",
" return geometric_mean_result\n",
" # Calculate the nth root of the product and return it\n",
" return product ** (1 / len(num_lst))\n",
"\n",
"# Test the function with the provided list of numbers\n",
"test_number_list = [64, 9, 90, 28, 46, 95, 34, 28, 86, 62, 14, 77, 99, 80,\n",
...
...
@@ -119,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count":
1
0,
"execution_count":
3
0,
"metadata": {
"deletable": false
},
...
...
@@ -208,7 +201,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 3
1
,
"metadata": {
"deletable": false
},
...
...
@@ -222,7 +215,7 @@
}
],
"source": [
"def read_all_csv_data(file_name, conversion_indicators)
-> dict
:\n",
"def read_all_csv_data(file_name, conversion_indicators):\n",
" \"\"\"\n",
" This function will return all columns data as a dictionary\n",
" :param file_name: CSV file path\n",
...
...
@@ -251,9 +244,9 @@
"\n",
"file_path = 'task1.csv'\n",
"conversion_flags = [True, True, True, True, True, True, True, True, True, True]\n",
"
data_dict
= read_all_csv_data(file_path, conversion_flags)\n",
"
all_csv_data
= read_all_csv_data(file_path, conversion_flags)\n",
"\n",
"print(
data_dict
)"
"print(
all_csv_data
)"
]
},
{
...
...
@@ -287,7 +280,7 @@
},
{
"cell_type": "code",
"execution_count": 2
1
,
"execution_count":
3
2,
"outputs": [
{
"name": "stdout",
...
...
@@ -309,10 +302,10 @@
" for i, val in enumerate(sorted(lst), 1):\n",
" ranks.setdefault(val, []).append(i)\n",
"\n",
" # get the average rank of each item using dictionary comprehension\n",
" avg_ranks = {v: sum(r) / len(r) for v, r in ranks.items()}\n",
"\n",
" ranked_list = [avg_ranks[val] for val in lst]\n",
" return ranked_list\n",
" return [avg_ranks[val] for val in lst]\n",
"\n",
"\n",
"def sm_correlation_coefficient(data1, data2):\n",
...
...
@@ -332,16 +325,15 @@
" # get the sum of squared differences of each item in both lists\n",
" sum_sqr_diff = 0\n",
" for i in range(len(ranked_data1)):\n",
"\n",
" diff = ranked_data1[i] - ranked_data2[i] # differences of each list item\n",
" sqr = diff ** 2 # squared differences\n",
" sum_sqr_diff += sqr # get the sum of each squared differences\n",
"\n",
" # Calculate the Spear-man's Rank Correlation Coefficient using the formula\n",
" n = len(data1)\n",
" correlation = 1 - (6 * sum_sqr_diff) / (n * (n ** 2 - 1))\n",
" correlation
_coefficient
= 1 - (6 * sum_sqr_diff) / (n * (n ** 2 - 1))\n",
"\n",
" return correlation\n",
" return correlation
_coefficient
\n",
"\n",
"\n",
"# Read two columns of data from the CSV file\n",
...
...
@@ -371,7 +363,7 @@
},
{
"cell_type": "code",
"execution_count":
25
,
"execution_count":
33
,
"metadata": {
"deletable": false
},
...
...
@@ -385,16 +377,16 @@
}
],
"source": [
"def generate_correlation_coefficients(csv_file_path):\n",
"def generate_
all_
correlation_coefficients(csv_file_path):\n",
" # Read the data from the CSV file\n",
" con
_flag
s = [True, True, True, True, True, True, True, True, True, True]\n",
" column_data = read_all_csv_data(csv_file_path, con
_flag
s)\n",
" con
version_indicator
s = [True, True, True, True, True, True, True, True, True, True]\n",
"
all_
column_data = read_all_csv_data(csv_file_path, con
version_indicator
s)\n",
"\n",
" # Get the column names\n",
" column_names = list(column_data.keys())\n",
" column_names = list(
all_
column_data.keys())\n",
"\n",
" # Initialize an empty list to store the correlation coefficients\n",
" correlation_coefficients = []\n",
"
all_
correlation_coefficients = []\n",
"\n",
" # Iterate through all pairs of columns\n",
" for i in range(len(column_names)):\n",
...
...
@@ -403,23 +395,25 @@
" continue # skip the comparison of the same column with itself\n",
"\n",
" col1_name = column_names[i]\n",
" col1_data = column_data[col1_name]\n",
" col1_data =
all_
column_data[col1_name]\n",
"\n",
" col2_name = column_names[j]\n",
" col2_data = column_data[col2_name]\n",
" col2_data =
all_
column_data[col2_name]\n",
"\n",
" # Calculate the Spearman's Rank Correlation Coefficient for the current pair of columns\n",
" try:\n",
" coefficient = sm_correlation_coefficient(col1_data, col2_data)\n",
" correlation_coefficients.append((col1_name, col2_name, coefficient))\n",
"
sm_cor_
coefficient = sm_correlation_coefficient(col1_data, col2_data)\n",
"
all_
correlation_coefficients.append((col1_name, col2_name,
sm_cor_
coefficient))\n",
" except ValueError as e:\n",
" print(f\"Error occured: {e}\")\n",
" print(f\"A value error occurred: {e}\")\n",
" except Exception as ex:\n",
" print(f\"An error occurred: {ex}\")\n",
"\n",
" return correlation_coefficients\n",
" return
all_
correlation_coefficients\n",
"\n",
"# Test the generate_correlation_coefficients function\n",
"file_path = 'task1.csv'\n",
"result = generate_correlation_coefficients(file_path)\n",
"result = generate_
all_
correlation_coefficients(file_path)\n",
"print(result)\n"
]
},
...
...
@@ -444,15 +438,97 @@
},
{
"cell_type": "code",
"execution_count":
6
,
"execution_count":
187
,
"metadata": {
"deletable": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n",
" $ age $ pop $ share_white $ share_black $\n",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n",
"$ age $ - $ 0.0084 $ 0.2207 $ -0.1034 $\n",
"$ pop $ 0.0084 $ - $ 0.0767 $ -0.1339 $\n",
"$ share_white $ 0.2207 $ 0.0767 $ - $ -0.4917 $\n",
"$ share_black $ -0.1034 $ -0.1339 $ -0.4917 $ - $\n",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n"
]
}
],
"source": [
"# replace with your code"
"def print_table(correlations, border_char, columns):\n",
" # Find the length of the longest string in the list and add constant to define cell length\n",
" longest_string_length = len(max(columns, key=len))\n",
" max_cell_length = longest_string_length + 5\n",
"\n",
" # print top boarder\n",
" # Initialize a variable to hold the sum of string lengths starts with 1 to hold the cell gap.\n",
" sum_col_lengths = 1\n",
"\n",
" # Loop over each string in the list and add its length to the running total\n",
" for name in columns:\n",
" sum_col_lengths += len(name)\n",
"\n",
" sum_col_lengths += len(columns) * 7\n",
" print(\" \" * max_cell_length + \"$\" * sum_col_lengths)\n",
"\n",
" # print the column names\n",
" print(\" \" * max_cell_length, end=\"\")\n",
" for name in columns:\n",
" print(border_char + \" \" * 3 + name + \" \" * 3 , end=\"\")\n",
" print(\"$\")\n",
"\n",
" # print header separator\n",
" print(\"$\" * (max_cell_length + sum_col_lengths))\n",
"\n",
" # print the correlation coefficients\n",
" for i, value in enumerate(columns):\n",
" string_len_diff = longest_string_length - len(value) + 5\n",
" space_count = int(string_len_diff / 2)\n",
"\n",
" if len(value) % 2 == 0:\n",
" print(border_char + space_count * \" \" + value + (space_count - 1) * \" \", end=\"\")\n",
" else:\n",
" print(border_char + space_count * \" \" + value + space_count * \" \", end=\"\")\n",
"\n",
" for col_name in columns:\n",
" if value == col_name:\n",
" cell_space = int(((len(col_name) + 7 ) / 2) -1) * \" \"\n",
" print(border_char + cell_space + \"-\" + cell_space, end=\"\")\n",
"\n",
" else:\n",
" for element in correlations:\n",
" if element[0] == value and element[1] == col_name:\n",
" correlation_coefficient = round(element[2], 4)\n",
" cell_space = (len(col_name)) // 2 * \" \"\n",
" if correlation_coefficient > 0:\n",
" print(border_char + \" \" +cell_space + str(correlation_coefficient) + cell_space, end=\"\")\n",
" else:\n",
" print(border_char +cell_space + str(correlation_coefficient) + cell_space, end=\"\")\n",
"\n",
"\n",
" print(\"$\")\n",
"\n",
" # print footer\n",
" # print header separator\n",
" print(\"$\" * (max_cell_length + sum_col_lengths))\n",
"\n",
"\n",
"file_path = 'task1.csv'\n",
"columns_to_include = ['age','pop', 'share_white', 'share_black']\n",
"print_table(generate_all_correlation_coefficients(file_path), '$', columns_to_include)"
]
},
{
"cell_type": "markdown",
"source": [],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"metadata": {
...
...
%% Cell type:markdown id: tags:
# UFCFVQ-15-M Programming for Data Science (Spring 2023)
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
OVERALL COURSEWORK MARK: ___%
</p>
%% Cell type:markdown id: tags:
### GitLab link submission, README.md file and Git commit messages
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
# Python Programming (Task B)
## Student Id:
%% Cell type:markdown id: tags:
### Requirement FR1 - Develop a function to find the geometric mean
%% Cell type:code id: tags:
```
python
def
geometric_mean
(
num
bers
):
def
geometric_mean
(
num
_lst
):
"""
Calculate the geometric mean of a list of numbers.
Parameters:
numbers (list): A list of positive integers or floats.
Returns:
float: The geometric mean of the numbers in the list.
:param num_lst: A list of positive integers or floats.
:returns float: The geometric mean of the numbers in the list.
"""
# Initialize the product of the numbers
product
=
1
# Length of the list
num_elements
=
len
(
numbers
)
# Iterate through the list of numbers and multiply each number
for
number
in
num
bers
:
for
number
in
num
_lst
:
product
*=
number
# Calculate the nth root of the product
geometric_mean_result
=
product
**
(
1
/
num_elements
)
return
geometric_mean_result
# Calculate the nth root of the product and return it
return
product
**
(
1
/
len
(
num_lst
))
# Test the function with the provided list of numbers
test_number_list
=
[
64
,
9
,
90
,
28
,
46
,
95
,
34
,
28
,
86
,
62
,
14
,
77
,
99
,
80
,
99
,
56
,
79
,
37
,
74
,
6
,
67
,
32
,
5
,
94
,
53
,
62
,
19
,
44
,
16
,
74
,
92
,
60
,
74
,
80
,
10
,
43
,
51
,
41
,
91
,
41
,
27
,
40
,
48
,
27
,
13
,
41
,
13
,
28
,
17
,
64
]
result
=
geometric_mean
(
test_number_list
)
print
(
f
"
The geometric mean of the list is:
{
result
}
"
)
```
%% Output
The geometric mean of the list is: 40.40574036744275
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
### Requirement FR2 - Develop a function to read a single column from a CSV file
%% Cell type:code id: tags:
```
python
def
read_csv_column
(
file
,
index
,
convert_to_numbers
=
True
):
"""
:param file: The path of the CSV file.
:param index: The index of the column to read (0-based).
:param convert_to_numbers: True if the column values should be converted to numbers, False otherwise.
:return: A tuple containing a list of the specified column
'
s data values and the column name.
"""
try
:
# Open the CSV file
with
open
(
file
,
'
r
'
)
as
csvfile
:
# Initialize the data list
csv_column_data
=
[]
# Read the file content line by line
lines
=
csvfile
.
readlines
()
# Get the header row and extract the column name
header
=
lines
.
pop
(
0
).
strip
().
split
(
'
,
'
)
col_name
=
header
[
index
]
# Iterate through the remaining lines
for
line
in
lines
:
# Split the line by commas
row
=
line
.
strip
().
split
(
'
,
'
)
# Get the value from the specified column
value
=
row
[
index
]
# Convert the value to a number if the flag is set to True
if
convert_to_numbers
:
try
:
value
=
float
(
value
)
except
ValueError
:
pass
# If the conversion fails, keep the value as a string
# Add the value to the data list
csv_column_data
.
append
(
value
)
return
col_name
,
csv_column_data
except
FileNotFoundError
:
print
(
f
"
Error: File
{
file
}
not found.
"
)
return
None
,
None
# Test the function using the 'task1.csv' file and a specified column index
file_path
=
'
task1.csv
'
column_index
=
0
column_name
,
data
=
read_csv_column
(
file_path
,
column_index
)
print
(
f
"
Column name:
{
column_name
}
"
)
print
(
f
"
Data:
{
data
}
"
)
```
%% Output
Column name: age
Data: [16.0, 27.0, 26.0, 25.0, 29.0, 29.0, 22.0, 35.0, 44.0, 31.0, 76.0, 40.0, 31.0, 23.0, 39.0, 25.0, 54.0, 24.0, 57.0, 21.0, 42.0, 21.0, 36.0, 26.0, 49.0, 54.0, 26.0, 48.0, 33.0, 21.0, 41.0, 48.0, 36.0, 41.0, 29.0, 27.0, 45.0, 32.0, 35.0, 36.0, 35.0, 40.0, 18.0, 34.0, 39.0, 21.0, 62.0, 43.0, 44.0, 29.0, 35.0, 50.0, 18.0, 25.0, 31.0, 29.0, 49.0, 23.0, 45.0, 26.0, 35.0, 34.0, 46.0, 29.0, 39.0, 28.0, 51.0, 67.0, 53.0, 25.0, 30.0, 24.0, 35.0, 43.0, 24.0, 29.0, 38.0, 31.0, 36.0, 23.0, 38.0, 53.0, 24.0, 26.0, 28.0, 34.0, 28.0, 40.0, 51.0, 44.0, 25.0, 56.0, 37.0, 58.0, 39.0, 37.0, 35.0, 26.0, 47.0, 31.0, 60.0, 32.0, 45.0, 42.0, 17.0, 22.0, 33.0, 18.0, 39.0, 59.0, 33.0, 58.0, 58.0, 47.0, 41.0, 64.0, 45.0, 53.0, 24.0, 48.0, 29.0, 40.0, 34.0, 21.0, 26.0, 45.0, 25.0, 17.0, 24.0, 42.0, 29.0, 42.0, 30.0, 29.0, 39.0, 63.0, 49.0, 41.0, 27.0, 30.0, 60.0, 77.0, 19.0, 37.0, 54.0, 29.0, 30.0, 24.0, 21.0, 44.0, 40.0, 32.0, 22.0, 43.0, 52.0, 27.0, 34.0, 20.0, 25.0, 24.0, 20.0, 46.0, 42.0, 43.0, 41.0, 59.0, 25.0, 42.0, 64.0, 22.0, 24.0, 63.0, 56.0, 60.0, 54.0, 37.0, 22.0, 39.0, 45.0, 57.0, 42.0, 19.0, 26.0, 34.0, 69.0, 64.0, 35.0, 40.0, 19.0, 27.0, 37.0, 17.0, 39.0, 74.0, 42.0, 47.0, 43.0, 46.0, 44.0, 31.0, 47.0, 41.0, 43.0, 40.0, 32.0, 31.0, 20.0, 20.0, 33.0, 22.0, 41.0, 41.0, 32.0, 16.0, 29.0, 42.0, 29.0, 47.0, 53.0, 18.0, 47.0, 34.0, 36.0, 63.0, 36.0, 27.0, 28.0, 33.0, 32.0, 42.0, 31.0, 17.0, 28.0, 24.0, 71.0, 51.0, 28.0, 53.0, 54.0, 45.0, 33.0, 48.0, 34.0, 23.0, 35.0, 33.0, 32.0, 52.0, 30.0, 23.0, 35.0, 42.0, 37.0, 56.0, 36.0, 27.0, 30.0, 31.0, 46.0, 51.0, 72.0, 28.0, 63.0, 28.0, 33.0, 24.0, 27.0, 24.0, 28.0, 28.0, 17.0, 46.0, 52.0, 39.0, 49.0, 30.0, 51.0, 16.0, 18.0, 22.0, 40.0, 61.0, 52.0, 51.0, 36.0, 36.0, 59.0, 17.0, 18.0, 41.0, 33.0, 25.0, 23.0, 47.0, 58.0, 47.0, 34.0, 28.0, 37.0, 87.0, 39.0, 27.0, 35.0, 36.0, 24.0, 26.0, 34.0, 51.0, 49.0, 41.0, 54.0, 36.0, 26.0, 35.0, 22.0, 27.0, 42.0, 32.0, 32.0, 25.0, 26.0, 53.0, 26.0, 40.0, 55.0, 29.0, 31.0, 19.0, 57.0, 40.0, 35.0, 35.0, 39.0, 37.0, 36.0, 62.0, 43.0, 32.0, 34.0, 37.0, 37.0, 33.0, 35.0, 40.0, 21.0, 30.0, 23.0, 26.0, 39.0, 33.0, 34.0, 37.0, 26.0, 24.0, 25.0, 31.0, 49.0, 59.0, 50.0, 37.0, 28.0, 26.0, 23.0, 32.0, 24.0, 42.0, 34.0, 68.0, 31.0, 83.0, 35.0, 29.0, 50.0, 56.0, 43.0, 38.0, 27.0, 36.0, 55.0, 36.0, 68.0, 61.0, 46.0, 47.0, 26.0, 37.0, 22.0, 18.0, 39.0, 49.0, 23.0, 47.0, 32.0, 45.0, 51.0, 31.0, 54.0, 31.0, 23.0, 29.0, 28.0, 31.0, 24.0, 27.0, 57.0, 39.0, 38.0, 34.0, 39.0, 20.0, 35.0, 36.0, 38.0, 33.0, 57.0, 38.0, 72.0, 37.0, 47.0, 43.0, 37.0, 75.0, 21.0, 20.0, 29.0, 37.0, 41.0, 22.0, 23.0, 64.0, 34.0, 49.0, 32.0, 25.0, 39.0, 53.0, 27.0, 36.0, 20.0, 39.0, 19.0, 34.0, 36.0, 34.0, 31.0, 45.0, 34.0, 31.0, 28.0, 57.0, 29.0, 50.0, 40.0, 35.0, 53.0, 59.0, 18.0, 28.0, 52.0, 38.0, 48.0]
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
### Requirement FR3 - Develop a function to read CSV data from a file into memory
%% Cell type:code id: tags:
```
python
def
read_all_csv_data
(
file_name
,
conversion_indicators
)
->
dict
:
def
read_all_csv_data
(
file_name
,
conversion_indicators
):
"""
This function will return all columns data as a dictionary
:param file_name: CSV file path
:param conversion_indicators: indicator to check column values should be converted from strings to numbers
:return: dictionary
"""
#initializing the data dictionary
dict_data
=
{}
try
:
with
open
(
file_name
,
'
r
'
)
as
csv_file
:
#get the number of columns with headers
header
=
csv_file
.
readline
().
strip
().
split
(
'
,
'
)
num_columns
=
len
(
header
)
for
index
in
range
(
num_columns
):
convert
=
conversion_indicators
[
index
]
col_name
,
col_data
=
read_csv_column
(
file_name
,
index
,
convert
)
#add data to the dictionary
dict_data
[
col_name
]
=
col_data
return
dict_data
except
FileNotFoundError
:
print
(
f
"
Error: File
{
file_name
}
not found.
"
)
return
None
file_path
=
'
task1.csv
'
conversion_flags
=
[
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
]
data_dict
=
read_all_csv_data
(
file_path
,
conversion_flags
)
all_csv_data
=
read_all_csv_data
(
file_path
,
conversion_flags
)
print
(
data_dict
)
print
(
all_csv_data
)
```
%% Output
{'age': [16.0, 27.0, 26.0, 25.0, 29.0, 29.0, 22.0, 35.0, 44.0, 31.0, 76.0, 40.0, 31.0, 23.0, 39.0, 25.0, 54.0, 24.0, 57.0, 21.0, 42.0, 21.0, 36.0, 26.0, 49.0, 54.0, 26.0, 48.0, 33.0, 21.0, 41.0, 48.0, 36.0, 41.0, 29.0, 27.0, 45.0, 32.0, 35.0, 36.0, 35.0, 40.0, 18.0, 34.0, 39.0, 21.0, 62.0, 43.0, 44.0, 29.0, 35.0, 50.0, 18.0, 25.0, 31.0, 29.0, 49.0, 23.0, 45.0, 26.0, 35.0, 34.0, 46.0, 29.0, 39.0, 28.0, 51.0, 67.0, 53.0, 25.0, 30.0, 24.0, 35.0, 43.0, 24.0, 29.0, 38.0, 31.0, 36.0, 23.0, 38.0, 53.0, 24.0, 26.0, 28.0, 34.0, 28.0, 40.0, 51.0, 44.0, 25.0, 56.0, 37.0, 58.0, 39.0, 37.0, 35.0, 26.0, 47.0, 31.0, 60.0, 32.0, 45.0, 42.0, 17.0, 22.0, 33.0, 18.0, 39.0, 59.0, 33.0, 58.0, 58.0, 47.0, 41.0, 64.0, 45.0, 53.0, 24.0, 48.0, 29.0, 40.0, 34.0, 21.0, 26.0, 45.0, 25.0, 17.0, 24.0, 42.0, 29.0, 42.0, 30.0, 29.0, 39.0, 63.0, 49.0, 41.0, 27.0, 30.0, 60.0, 77.0, 19.0, 37.0, 54.0, 29.0, 30.0, 24.0, 21.0, 44.0, 40.0, 32.0, 22.0, 43.0, 52.0, 27.0, 34.0, 20.0, 25.0, 24.0, 20.0, 46.0, 42.0, 43.0, 41.0, 59.0, 25.0, 42.0, 64.0, 22.0, 24.0, 63.0, 56.0, 60.0, 54.0, 37.0, 22.0, 39.0, 45.0, 57.0, 42.0, 19.0, 26.0, 34.0, 69.0, 64.0, 35.0, 40.0, 19.0, 27.0, 37.0, 17.0, 39.0, 74.0, 42.0, 47.0, 43.0, 46.0, 44.0, 31.0, 47.0, 41.0, 43.0, 40.0, 32.0, 31.0, 20.0, 20.0, 33.0, 22.0, 41.0, 41.0, 32.0, 16.0, 29.0, 42.0, 29.0, 47.0, 53.0, 18.0, 47.0, 34.0, 36.0, 63.0, 36.0, 27.0, 28.0, 33.0, 32.0, 42.0, 31.0, 17.0, 28.0, 24.0, 71.0, 51.0, 28.0, 53.0, 54.0, 45.0, 33.0, 48.0, 34.0, 23.0, 35.0, 33.0, 32.0, 52.0, 30.0, 23.0, 35.0, 42.0, 37.0, 56.0, 36.0, 27.0, 30.0, 31.0, 46.0, 51.0, 72.0, 28.0, 63.0, 28.0, 33.0, 24.0, 27.0, 24.0, 28.0, 28.0, 17.0, 46.0, 52.0, 39.0, 49.0, 30.0, 51.0, 16.0, 18.0, 22.0, 40.0, 61.0, 52.0, 51.0, 36.0, 36.0, 59.0, 17.0, 18.0, 41.0, 33.0, 25.0, 23.0, 47.0, 58.0, 47.0, 34.0, 28.0, 37.0, 87.0, 39.0, 27.0, 35.0, 36.0, 24.0, 26.0, 34.0, 51.0, 49.0, 41.0, 54.0, 36.0, 26.0, 35.0, 22.0, 27.0, 42.0, 32.0, 32.0, 25.0, 26.0, 53.0, 26.0, 40.0, 55.0, 29.0, 31.0, 19.0, 57.0, 40.0, 35.0, 35.0, 39.0, 37.0, 36.0, 62.0, 43.0, 32.0, 34.0, 37.0, 37.0, 33.0, 35.0, 40.0, 21.0, 30.0, 23.0, 26.0, 39.0, 33.0, 34.0, 37.0, 26.0, 24.0, 25.0, 31.0, 49.0, 59.0, 50.0, 37.0, 28.0, 26.0, 23.0, 32.0, 24.0, 42.0, 34.0, 68.0, 31.0, 83.0, 35.0, 29.0, 50.0, 56.0, 43.0, 38.0, 27.0, 36.0, 55.0, 36.0, 68.0, 61.0, 46.0, 47.0, 26.0, 37.0, 22.0, 18.0, 39.0, 49.0, 23.0, 47.0, 32.0, 45.0, 51.0, 31.0, 54.0, 31.0, 23.0, 29.0, 28.0, 31.0, 24.0, 27.0, 57.0, 39.0, 38.0, 34.0, 39.0, 20.0, 35.0, 36.0, 38.0, 33.0, 57.0, 38.0, 72.0, 37.0, 47.0, 43.0, 37.0, 75.0, 21.0, 20.0, 29.0, 37.0, 41.0, 22.0, 23.0, 64.0, 34.0, 49.0, 32.0, 25.0, 39.0, 53.0, 27.0, 36.0, 20.0, 39.0, 19.0, 34.0, 36.0, 34.0, 31.0, 45.0, 34.0, 31.0, 28.0, 57.0, 29.0, 50.0, 40.0, 35.0, 53.0, 59.0, 18.0, 28.0, 52.0, 38.0, 48.0], 'pop': [3779.0, 2769.0, 4079.0, 4343.0, 6809.0, 4682.0, 5027.0, 5238.0, 4832.0, 3795.0, 2786.0, 9429.0, 3413.0, 5573.0, 6315.0, 1997.0, 3651.0, 5286.0, 5740.0, 4303.0, 5213.0, 4149.0, 6460.0, 3348.0, 5824.0, 4521.0, 3202.0, 6172.0, 4160.0, 7886.0, 4924.0, 4228.0, 6018.0, 5601.0, 2742.0, 3305.0, 4838.0, 2584.0, 6747.0, 3245.0, 4947.0, 5887.0, 5004.0, 4465.0, 8623.0, 3013.0, 3580.0, 5876.0, 5203.0, 4601.0, 2664.0, 8874.0, 2182.0, 6701.0, 9680.0, 2860.0, 5057.0, 4179.0, 3880.0, 3078.0, 3770.0, 4689.0, 1392.0, 10220.0, 4828.0, 3568.0, 3035.0, 2422.0, 5102.0, 2560.0, 2621.0, 4049.0, 2367.0, 5222.0, 5304.0, 3357.0, 3548.0, 3886.0, 7687.0, 18168.0, 6987.0, 3292.0, 6457.0, 10229.0, 4377.0, 3520.0, 11284.0, 3121.0, 4941.0, 4293.0, 4917.0, 8205.0, 3531.0, 11794.0, 2314.0, 3887.0, 4904.0, 1625.0, 1812.0, 1970.0, 5787.0, 2023.0, 3481.0, 5059.0, 2291.0, 3864.0, 4934.0, 5100.0, 4596.0, 4487.0, 4745.0, 2991.0, 4968.0, 3403.0, 4066.0, 4225.0, 4791.0, 4643.0, 6056.0, 4232.0, 6074.0, 5169.0, 5029.0, 8222.0, 3536.0, 4044.0, 3085.0, 3751.0, 6461.0, 4542.0, 5072.0, 2156.0, 6106.0, 2733.0, 5335.0, 3721.0, 6604.0, 3700.0, 7499.0, 5994.0, 8023.0, 3708.0, 5206.0, 5950.0, 3070.0, 2886.0, 4775.0, 6844.0, 5206.0, 3300.0, 5269.0, 4681.0, 5921.0, 3082.0, 7528.0, 9699.0, 4356.0, 6613.0, 6493.0, 4074.0, 4863.0, 4720.0, 4284.0, 4726.0, 4412.0, 4411.0, 3544.0, 2674.0, 1911.0, 3396.0, 5383.0, 2650.0, 4040.0, 6460.0, 6971.0, 5823.0, 12351.0, 7338.0, 4239.0, 3422.0, 3255.0, 4424.0, 3754.0, 6466.0, 2143.0, 3358.0, 7538.0, 2929.0, 1325.0, 2665.0, 2537.0, 1404.0, 732.0, 4049.0, 3745.0, 4447.0, 8668.0, 2892.0, 4696.0, 3636.0, 4911.0, 3524.0, 2712.0, 5737.0, 6851.0, 1862.0, 8196.0, 2986.0, 7471.0, 678.0, 6941.0, 8810.0, 5938.0, 5437.0, 4296.0, 2993.0, 8033.0, 1354.0, 4523.0, 1781.0, 6740.0, 4748.0, 6084.0, 7883.0, 6993.0, 6384.0, 4498.0, 4419.0, 2875.0, 3436.0, 4923.0, 4293.0, 6202.0, 4302.0, 2979.0, 5506.0, 4579.0, 3307.0, 3042.0, 5683.0, 3522.0, 3238.0, 3404.0, 4020.0, 5651.0, 2619.0, 2732.0, 5977.0, 6081.0, 6230.0, 4227.0, 5947.0, 3660.0, 4966.0, 4759.0, 13987.0, 4716.0, 2680.0, 3748.0, 2808.0, 7956.0, 3859.0, 6257.0, 5153.0, 5442.0, 1363.0, 4792.0, 5808.0, 4264.0, 26826.0, 3111.0, 4082.0, 3535.0, 3219.0, 3803.0, 5863.0, 3817.0, 4294.0, 3014.0, 4378.0, 8081.0, 3045.0, 13561.0, 6142.0, 4702.0, 7753.0, 3276.0, 4045.0, 3088.0, 1683.0, 5733.0, 4945.0, 3641.0, 4667.0, 5006.0, 4978.0, 3715.0, 7864.0, 4502.0, 3947.0, 4630.0, 4192.0, 4371.0, 1471.0, 2391.0, 4283.0, 7340.0, 2917.0, 4083.0, 5199.0, 3954.0, 6876.0, 3441.0, 3140.0, 5502.0, 4517.0, 5372.0, 5731.0, 3021.0, 2485.0, 3172.0, 2911.0, 5726.0, 8064.0, 5329.0, 7585.0, 2816.0, 4189.0, 4466.0, 6530.0, 4480.0, 4865.0, 4129.0, 5456.0, 2377.0, 5169.0, 5062.0, 2150.0, 4775.0, 6415.0, 7408.0, 1977.0, 6888.0, 3776.0, 5931.0, 3687.0, 3574.0, 4829.0, 8988.0, 4542.0, 8810.0, 1345.0, 5747.0, 3040.0, 7323.0, 9738.0, 3902.0, 8960.0, 7556.0, 7099.0, 6309.0, 2802.0, 4866.0, 7621.0, 6185.0, 4908.0, 1990.0, 4836.0, 4321.0, 5410.0, 4017.0, 3679.0, 1271.0, 6657.0, 6033.0, 5378.0, 1610.0, 4284.0, 2186.0, 3921.0, 6016.0, 7456.0, 3721.0, 5375.0, 4430.0, 2666.0, 4315.0, 2355.0, 5158.0, 2923.0, 3300.0, 4932.0, 6118.0, 4279.0, 3999.0, 5917.0, 6747.0, 6001.0, 3755.0, 4993.0, 4579.0, 2459.0, 5449.0, 8776.0, 4026.0, 5447.0, 5543.0, 7914.0, 5791.0, 3362.0, 2747.0, 7010.0, 403.0, 7371.0, 3081.0, 3681.0, 2868.0, 1548.0, 2758.0, 7590.0, 6145.0, 1753.0, 1925.0, 3501.0, 2326.0, 3737.0, 3630.0, 5246.0, 7671.0, 1548.0, 2150.0, 11719.0, 3416.0, 3394.0, 2646.0, 4347.0, 6462.0, 2886.0, 2024.0, 3565.0, 6145.0, 4177.0, 4980.0, 2032.0, 10818.0, 2657.0, 5459.0, 5065.0, 3862.0, 4164.0, 4996.0, 4110.0, 4074.0, 3507.0, 4547.0, 5065.0, 1640.0, 4154.0, 3850.0, 2544.0, 5177.0], 'share_white': [60.5, 53.8, 73.8, 1.2, 92.5, 7.0, 50.8, 8.6, 14.6, 63.6, 51.4, 67.3, 83.7, 64.0, 37.5, 30.5, 52.2, 44.8, 31.3, 28.3, 92.3, 40.3, 17.8, 77.7, 78.1, 94.0, 7.7, 86.2, 6.0, 56.6, 1.6, 0.6, 89.9, 93.7, 42.0, 60.1, 65.1, 4.3, 16.5, 53.7, 94.1, 33.9, 83.9, 72.1, 4.2, 3.3, 5.1, 59.9, 15.8, 39.3, 60.6, 57.0, 0.0, 74.9, 89.0, 70.7, 79.7, 2.0, 69.7, 1.9, 94.9, 93.2, 43.0, 86.2, 73.2, 12.2, 46.0, 95.9, 94.4, 0.0, 18.1, 6.5, 40.7, 18.0, 71.5, 41.0, 88.7, 67.2, 61.8, 52.5, 78.2, 94.9, 62.7, 32.9, 82.8, 63.6, 31.8, 3.8, 1.5, 87.8, 8.5, 69.3, 51.6, 62.5, 55.5, 49.2, 23.7, 17.4, 43.6, 41.5, 65.4, 40.4, 88.9, 75.3, 74.0, 20.4, 5.7, 88.2, 94.1, 92.2, 44.7, 94.3, 95.7, 51.3, 76.8, 22.5, 9.5, 87.1, 54.9, 10.8, 3.2, 0.9, 47.3, 28.9, 52.2, 0.4, 19.0, 96.1, 23.6, 86.8, 37.5, 54.9, 55.0, 76.2, 9.3, 83.5, 94.3, 70.6, 21.5, 91.1, 25.2, 22.2, 65.0, 15.6, 11.3, 48.3, 34.7, 43.0, 65.0, 52.2, 68.6, 84.1, 7.9, 20.6, 12.6, 0.5, 67.9, 84.7, 11.1, 63.1, 46.4, 66.2, 70.2, 39.3, 21.2, 34.2, 0.1, 56.7, 66.2, 90.0, 86.9, 69.1, 80.6, 96.3, 82.8, 57.8, 74.2, 61.4, 84.3, 89.0, 99.6, 4.0, 33.1, 97.3, 94.2, 44.1, 4.6, 33.2, 0.2, 86.2, 16.0, 69.6, 56.7, 33.3, 87.2, 42.0, 85.5, 94.4, 96.5, 36.5, 96.8, 73.8, 63.2, 89.6, 62.2, 5.4, 79.4, 8.4, 70.9, 9.9, 58.6, 35.3, 62.5, 38.0, 72.5, 62.8, 14.0, 28.7, 39.3, 1.0, 99.4, 83.3, 56.8, 51.1, 64.1, 59.9, 56.5, 71.0, 85.7, 60.3, 87.3, 38.8, 87.4, 50.9, 67.9, 40.2, 30.6, 97.1, 90.0, 20.6, 90.5, 75.4, 63.9, 45.0, 71.2, 50.4, 59.2, 89.3, 1.5, 32.9, 79.9, 41.5, 67.9, 24.3, 34.1, 5.1, 76.9, 79.9, 29.6, 76.4, 14.9, 31.8, 63.1, 27.6, 52.8, 46.9, 82.7, 4.3, 37.7, 79.1, 26.6, 83.3, 45.7, 37.7, 38.6, 61.9, 75.3, 5.2, 68.0, 60.2, 67.6, 97.2, 64.4, 61.8, 75.3, 79.9, 71.0, 44.8, 92.3, 90.5, 25.5, 5.9, 28.5, 34.5, 91.8, 69.3, 1.6, 87.5, 75.4, 91.0, 92.7, 44.7, 2.4, 1.4, 18.9, 56.4, 19.2, 69.4, 62.0, 49.7, 80.7, 39.8, 5.8, 32.8, 47.5, 88.5, 62.1, 73.5, 94.7, 71.7, 16.1, 97.2, 74.9, 90.0, 9.7, 97.1, 93.4, 15.0, 87.2, 77.2, 40.1, 65.6, 33.3, 78.0, 3.2, 58.2, 23.3, 79.0, 34.7, 26.2, 58.6, 95.9, 73.5, 83.3, 14.5, 49.7, 37.0, 16.3, 94.4, 46.4, 35.3, 2.1, 42.6, 41.8, 5.9, 15.7, 94.5, 28.1, 23.5, 10.6, 69.7, 29.8, 7.2, 5.1, 86.7, 76.8, 1.1, 61.7, 19.6, 82.8, 37.4, 24.2, 0.6, 72.8, 47.6, 89.6, 58.6, 73.6, 85.8, 36.3, 62.3, 53.3, 82.5, 86.8, 95.5, 27.6, 49.0, 75.2, 1.7, 9.9, 52.2, 30.1, 47.3, 9.5, 2.3, 68.9, 16.5, 80.9, 13.0, 8.5, 30.6, 57.8, 4.8, 67.0, 8.5, 86.7, 81.1, 58.6, 86.3, 14.3, 54.5, 65.8, 26.1, 49.5, 37.8, 44.4, 66.6, 45.5, 58.0, 77.3, 71.5, 42.2, 36.9, 5.7, 49.4, 77.4, 68.7, 1.8, 7.5, 49.8, 1.0, 89.4, 5.7, 19.9, 88.0, 68.7, 72.1, 48.3, 41.3, 78.5, 90.7, 56.9, 72.2, 72.5, 89.5, 77.5, 74.8, 25.0, 0.3, 78.5, 87.4, 15.8, 89.2, 94.8, 84.7, 64.3, 40.9, 74.5, 83.2, 21.7, 23.1], 'share_black': [30.5, 36.2, 7.7, 0.6, 1.4, 7.7, 0.3, 0.2, 17.7, 7.7, 0.9, 0.6, 7.6, 23.5, 27.0, 58.4, 16.2, 6.9, 7.5, 5.1, 2.3, 10.7, 4.4, 0.9, 2.2, 1.8, 6.0, 7.4, 3.4, 1.2, 66.4, 98.6, 4.3, 0.6, 12.3, 9.5, 23.7, 3.4, 0.9, 44.4, 2.4, 2.6, 4.0, 14.5, 0.2, 11.7, 85.1, 31.7, 0.3, 0.1, 7.8, 17.7, 98.9, 0.8, 0.0, 4.5, 1.4, 1.1, 0.1, 47.3, 0.6, 0.3, 7.7, 6.4, 6.0, 18.9, 0.9, 0.0, 0.5, 98.4, 67.5, 31.8, 1.4, 54.9, 20.2, 1.7, 3.0, 21.7, 6.4, 36.5, 5.4, 3.7, 0.3, 15.0, 4.9, 7.7, 51.0, 81.2, 83.1, 0.0, 0.4, 2.8, 11.0, 15.8, 6.4, 0.1, 54.6, 75.7, 4.9, 52.6, 32.1, 44.0, 0.1, 13.7, 1.3, 9.8, 6.1, 8.5, 3.2, 2.9, 25.0, 3.9, 0.0, 47.8, 2.1, 1.8, 0.0, 1.8, 22.0, 86.4, 94.4, 19.5, 6.7, 22.8, 5.1, 84.8, 46.1, 0.1, 3.0, 0.3, 5.0, 42.7, 22.1, 0.0, 81.6, 9.0, 4.7, 24.1, 53.0, 2.1, 17.5, 77.8, 0.9, 5.8, 86.4, 8.1, 16.3, 18.6, 0.9, 23.8, 0.0, 0.3, 2.1, 5.9, 3.5, 0.2, 0.0, 4.4, 75.1, 0.5, 6.1, 30.9, 1.3, 27.1, 19.0, 57.3, 99.4, 9.1, 28.5, 9.3, 0.7, 0.8, 0.6, 0.3, 15.0, 7.4, 10.8, 24.2, 4.6, 8.6, 0.2, 9.5, 3.0, 0.8, 3.4, 18.9, 35.9, 62.2, 99.8, 9.8, 10.6, 6.6, 34.3, 43.7, 0.1, 27.1, 11.0, 0.0, 0.7, 57.6, 0.2, 2.5, 21.4, 0.0, 1.6, 93.1, 0.3, 88.0, 19.6, 68.6, 0.0, 19.7, 27.2, 53.0, 1.2, 32.1, 60.0, 17.7, 59.4, 95.0, 0.2, 2.2, 34.0, 0.4, 8.1, 34.0, 35.1, 21.0, 9.4, 8.8, 1.2, 43.2, 0.0, 31.2, 29.8, 12.6, 11.5, 0.5, 0.0, 74.2, 5.1, 1.6, 3.7, 34.2, 0.0, 11.7, 1.4, 4.9, 16.6, 18.3, 4.4, 9.1, 30.0, 4.9, 24.5, 2.7, 8.5, 3.8, 13.1, 1.7, 24.9, 9.3, 9.4, 0.7, 1.8, 1.0, 8.9, 0.3, 22.7, 4.6, 40.7, 1.5, 21.4, 17.2, 9.1, 20.5, 3.5, 93.6, 17.4, 4.0, 26.3, 0.3, 24.6, 29.3, 1.1, 0.0, 17.6, 34.1, 1.3, 0.6, 11.1, 83.0, 59.4, 59.4, 5.1, 0.0, 92.7, 0.1, 8.6, 0.6, 0.1, 0.0, 2.0, 87.2, 42.3, 31.8, 75.3, 4.4, 0.4, 16.5, 0.7, 7.0, 92.8, 7.8, 28.2, 9.9, 7.1, 0.9, 0.9, 2.3, 2.6, 1.3, 2.3, 1.8, 89.1, 1.1, 2.0, 0.4, 0.2, 17.8, 45.6, 11.1, 0.7, 15.7, 0.0, 9.8, 0.9, 4.1, 16.3, 24.0, 17.8, 2.0, 5.6, 2.2, 4.5, 13.6, 45.7, 12.0, 0.9, 5.3, 19.7, 84.2, 3.2, 8.7, 14.5, 1.6, 0.2, 7.1, 1.3, 23.0, 16.6, 25.3, 1.9, 21.3, 3.3, 8.5, 60.3, 9.8, 3.5, 1.0, 10.7, 5.6, 95.6, 0.3, 0.3, 3.4, 25.5, 0.0, 0.5, 2.3, 6.1, 6.4, 10.5, 1.5, 0.0, 5.5, 2.5, 1.5, 0.0, 85.3, 23.8, 1.4, 8.8, 67.0, 0.8, 10.7, 0.9, 0.2, 10.4, 6.3, 11.5, 15.5, 0.4, 1.5, 0.0, 0.8, 8.6, 2.8, 2.1, 38.8, 0.0, 11.3, 13.4, 10.9, 28.2, 22.4, 8.0, 3.1, 11.3, 16.9, 2.6, 20.6, 43.4, 92.4, 40.0, 14.6, 5.5, 79.2, 92.5, 43.7, 98.6, 2.2, 0.0, 0.6, 2.6, 5.3, 0.9, 8.1, 0.6, 0.4, 1.3, 28.6, 25.9, 0.0, 0.0, 3.1, 8.8, 31.9, 37.0, 6.5, 10.0, 65.2, 0.9, 0.0, 1.4, 16.9, 53.8, 0.4, 10.1, 24.9, 4.0], 'share_hispanic': [5.6, 0.5, 16.8, 98.8, 1.7, 79.0, 44.2, 84.1, 66.3, 26.5, 44.9, 12.9, 3.1, 7.5, 24.7, 6.4, 15.7, 16.5, 15.2, 58.1, 2.9, 41.4, 76.4, 9.7, 15.1, 1.9, 77.9, 6.5, 89.9, 35.9, 35.2, 0.0, 1.4, 5.1, 37.1, 13.7, 6.3, 89.6, 78.7, 1.8, 2.6, 56.6, 5.5, 6.8, 93.9, 84.7, 6.2, 2.9, 81.5, 1.7, 10.5, 19.8, 0.1, 22.8, 8.1, 15.5, 14.5, 96.6, 28.0, 45.9, 3.2, 2.2, 1.0, 3.9, 14.4, 48.3, 51.3, 0.0, 2.9, 1.0, 11.5, 58.6, 35.8, 23.0, 3.9, 53.4, 1.7, 10.0, 15.4, 4.4, 14.2, 0.3, 28.3, 48.3, 5.3, 21.4, 12.0, 6.1, 15.6, 10.3, 89.6, 17.8, 18.4, 15.9, 36.0, 49.8, 7.0, 0.0, 36.0, 3.1, 1.5, 10.4, 6.4, 10.5, 20.3, 70.7, 88.5, 1.4, 1.5, 5.9, 1.9, 1.1, 2.0, 0.9, 8.8, 64.6, 33.9, 3.4, 19.1, 2.6, 5.0, 71.9, 29.0, 39.6, 41.5, 14.0, 28.8, 3.1, 49.1, 10.5, 54.3, 0.6, 14.9, 19.9, 13.5, 1.1, 0.1, 1.5, 20.9, 3.4, 53.5, 1.5, 30.3, 66.0, 0.0, 38.4, 14.6, 23.5, 30.3, 10.1, 23.6, 3.8, 83.7, 71.2, 77.0, 96.3, 27.1, 7.5, 11.3, 6.5, 24.4, 0.1, 23.3, 22.1, 57.8, 1.1, 0.0, 24.0, 3.8, 0.0, 2.9, 2.6, 10.5, 0.2, 0.4, 20.3, 9.1, 10.7, 6.0, 1.9, 0.0, 68.2, 52.5, 0.3, 1.1, 32.7, 35.9, 2.8, 0.0, 1.0, 72.4, 19.9, 7.1, 22.3, 5.0, 29.9, 0.7, 4.2, 1.6, 0.3, 0.8, 17.7, 4.7, 4.1, 28.7, 1.3, 17.1, 5.8, 7.1, 20.6, 40.4, 29.2, 8.4, 3.2, 19.3, 1.9, 26.6, 48.7, 0.0, 0.7, 0.0, 8.7, 4.4, 6.1, 24.7, 2.0, 2.9, 3.6, 2.7, 25.7, 9.2, 13.7, 10.4, 7.9, 1.3, 44.2, 44.4, 0.9, 6.7, 2.2, 2.2, 6.5, 26.6, 15.7, 23.6, 10.2, 24.3, 0.5, 36.3, 39.2, 10.4, 37.7, 0.1, 67.2, 26.0, 80.0, 4.0, 10.3, 56.0, 3.5, 34.2, 48.6, 18.8, 26.2, 41.3, 51.7, 3.2, 2.7, 10.9, 9.2, 26.2, 10.9, 28.2, 42.1, 52.8, 18.4, 14.3, 0.7, 6.4, 30.3, 4.3, 0.6, 5.2, 6.0, 17.3, 10.8, 2.7, 19.7, 5.7, 7.6, 13.6, 9.5, 6.1, 1.4, 1.5, 19.8, 5.1, 3.3, 4.9, 0.8, 1.6, 41.7, 72.0, 4.5, 5.4, 4.4, 4.8, 3.5, 31.7, 26.3, 1.4, 50.1, 2.5, 35.5, 22.6, 0.7, 15.5, 11.8, 3.4, 9.8, 70.9, 0.0, 12.0, 2.3, 0.0, 0.3, 1.3, 11.1, 3.6, 3.7, 3.1, 19.8, 61.8, 2.6, 96.8, 24.8, 68.0, 9.4, 14.6, 41.0, 7.9, 0.0, 4.5, 6.6, 7.9, 32.2, 10.6, 55.4, 3.1, 43.2, 29.2, 5.4, 52.9, 8.8, 62.7, 69.1, 0.2, 32.9, 72.3, 7.8, 3.3, 34.5, 83.4, 77.8, 3.1, 7.3, 37.2, 16.3, 74.1, 5.2, 47.7, 70.2, 3.9, 26.3, 50.6, 4.5, 10.0, 24.2, 6.0, 59.8, 30.0, 34.6, 0.4, 10.6, 0.0, 46.4, 22.5, 21.7, 94.3, 4.8, 10.1, 66.5, 43.7, 21.7, 97.1, 10.7, 78.7, 11.9, 61.1, 84.5, 44.4, 2.2, 94.8, 19.7, 27.3, 9.2, 2.7, 19.2, 0.0, 44.9, 42.3, 21.1, 2.0, 36.1, 8.9, 28.9, 21.0, 40.8, 15.6, 2.9, 18.7, 24.9, 1.5, 1.3, 4.7, 7.6, 5.6, 20.8, 0.0, 3.5, 0.2, 7.5, 80.8, 79.0, 4.0, 18.1, 19.5, 38.4, 55.3, 20.9, 5.5, 8.5, 0.3, 1.1, 8.4, 15.0, 4.2, 40.1, 60.3, 4.8, 0.0, 18.6, 6.0, 2.5, 7.7, 4.9, 0.0, 20.2, 0.3, 37.1, 12.3], 'personal_income': [28375.0, 14678.0, 25286.0, 17194.0, 33954.0, 15523.0, 25949.0, 25043.0, 16778.0, 22005.0, 26916.0, 51186.0, 25563.0, 25998.0, 20027.0, 23205.0, 29881.0, 41676.0, 37455.0, 27384.0, 23342.0, 22719.0, 18376.0, 17695.0, 21610.0, 32921.0, 22441.0, 23926.0, 13231.0, 19599.0, 14995.0, 22968.0, 34698.0, 22085.0, 21868.0, 32142.0, 21769.0, 15373.0, 16558.0, 17853.0, 20248.0, 17225.0, 26667.0, 15488.0, 19978.0, 18995.0, 14256.0, 18843.0, 21170.0, 20901.0, 86023.0, 22105.0, 14560.0, 27813.0, 28125.0, 42931.0, 20407.0, 18047.0, 35827.0, 17893.0, 31080.0, 25130.0, 35788.0, 28556.0, 27031.0, 11805.0, 20428.0, 12840.0, 31274.0, 14177.0, 13805.0, 16689.0, 14746.0, 8206.0, 22409.0, 37579.0, 33294.0, 22080.0, 21049.0, 37721.0, 21845.0, 23583.0, 14816.0, 22235.0, 21264.0, 21667.0, 22472.0, 25799.0, 21344.0, 30465.0, 19146.0, 38593.0, 21626.0, 24749.0, 16218.0, 22833.0, 39122.0, 11157.0, 22857.0, 12109.0, 22385.0, 20610.0, 10987.0, 21474.0, 21109.0, 18438.0, 12741.0, 30061.0, 29488.0, 30491.0, 18370.0, 24348.0, 23883.0, 15373.0, 41609.0, 21130.0, 19598.0, 33869.0, 16983.0, 23944.0, 20254.0, 15656.0, 26928.0, 30784.0, 19921.0, 14256.0, 18257.0, 32088.0, 26846.0, 36099.0, 22193.0, 19031.0, 28490.0, 21858.0, 14520.0, 25135.0, 21837.0, 19755.0, 20623.0, 51071.0, 21342.0, 13968.0, 16415.0, 24026.0, 37922.0, 17632.0, 31009.0, 35008.0, 16415.0, 16953.0, 20644.0, 31930.0, 27255.0, 19343.0, 22177.0, 16620.0, 27273.0, 26675.0, 18976.0, 37028.0, 31776.0, 18363.0, 23716.0, 23444.0, 30261.0, 25030.0, 14227.0, 23467.0, 21261.0, 31641.0, 41377.0, 18397.0, 40529.0, 22384.0, 23683.0, 20405.0, 27745.0, 36727.0, 21693.0, 20760.0, 26643.0, 17223.0, 14932.0, 18243.0, 16615.0, 27432.0, 21306.0, 20836.0, 14048.0, 18727.0, 17433.0, 14504.0, 11338.0, 15489.0, 30391.0, 18238.0, 38810.0, 39179.0, 30489.0, 22255.0, 24705.0, 41719.0, 20213.0, 22947.0, 30906.0, 10219.0, 22021.0, 11184.0, 19808.0, 18029.0, 18975.0, 37476.0, 19868.0, 25865.0, 28397.0, 22750.0, 19032.0, 12297.0, 19423.0, 26314.0, 15289.0, 30625.0, 29063.0, 36696.0, 35194.0, 17493.0, 19218.0, 16616.0, 37967.0, 26001.0, 27355.0, 32602.0, 20860.0, 20396.0, 18750.0, 21988.0, 23243.0, 48922.0, 23940.0, 22681.0, 27385.0, 24076.0, 34326.0, 22016.0, 23378.0, 32902.0, 45333.0, 32466.0, 16670.0, 26030.0, 22158.0, 14765.0, 20769.0, 15511.0, 28062.0, 15480.0, 23633.0, 27172.0, 17213.0, 19316.0, 24332.0, 22628.0, 30661.0, 30908.0, 22995.0, 22734.0, 19474.0, 13130.0, 23280.0, 40021.0, 21955.0, 33918.0, 19136.0, 25279.0, 23974.0, 29893.0, 23250.0, 14754.0, 16463.0, 32211.0, 25418.0, 18760.0, 34176.0, 25226.0, 36305.0, 31491.0, 41145.0, 14332.0, 26583.0, 23750.0, 20075.0, 26067.0, 17693.0, 18978.0, 19645.0, 29959.0, 35089.0, 28125.0, 17901.0, 27077.0, 54036.0, 28730.0, 12376.0, 20072.0, 11425.0, 22537.0, 26119.0, 5457.0, 17474.0, 15542.0, 24858.0, 19029.0, 13143.0, 17026.0, 25190.0, 19400.0, 30332.0, 64657.0, 33875.0, 25839.0, 29511.0, 21506.0, 20296.0, 17696.0, 13939.0, 27917.0, 13929.0, 30533.0, 18472.0, 20297.0, 30723.0, 23011.0, 18022.0, 49269.0, 14457.0, 11405.0, 21008.0, 15892.0, 31009.0, 21082.0, 5688.0, 21831.0, 25231.0, 21131.0, 42774.0, 16071.0, 45795.0, 16012.0, 42519.0, 40693.0, 37476.0, 9353.0, 22057.0, 39531.0, 15628.0, 25755.0, 36062.0, 37453.0, 17402.0, 34516.0, 23844.0, 40387.0, 22132.0, 17401.0, 43458.0, 14964.0, 15556.0, 28690.0, 18174.0, 25034.0, 20761.0, 26047.0, 11558.0, 26741.0, 26101.0, 28781.0, 20995.0, 22348.0, 23281.0, 21115.0, 27875.0, 31969.0, 20153.0, 30540.0, 18133.0, 32242.0, 30472.0, 25977.0, 14162.0, 12930.0, 16953.0, 21130.0, 24236.0, 19151.0, 20900.0, 43062.0, 16558.0, 21374.0, 15632.0, 19746.0, 23243.0, 23143.0, 15812.0, 44430.0, 17467.0, 34053.0, 33110.0, 44585.0, 19149.0, 16065.0, 24352.0, 29056.0, 21509.0, 20164.0, 26143.0, 21908.0, 19044.0, 15686.0, 21658.0, 20685.0, 20423.0, 29741.0, 15252.0, 12961.0, 11576.0, 31524.0, 26566.0, 16745.0, 18371.0, 15871.0, 11656.0, 36216.0, 17367.0, 14989.0, 36394.0, 18999.0, 26934.0, 17632.0, 15498.0, 27719.0, 35028.0, 19921.0, 22213.0, 25110.0, 27347.0, 35316.0, 26597.0, 29695.0, 16940.0, 52896.0, 27535.0, 14963.0, 54494.0, 31761.0, 42312.0, 31470.0, 25262.0, 18470.0, 21175.0, 26971.0, 33590.0], 'household_income': [51367.0, 27972.0, 45365.0, 48295.0, 68785.0, 20833.0, 58068.0, 66543.0, 30391.0, 44553.0, 56065.0, 117413.0, 44857.0, 39727.0, 25500.0, 56190.0, 38125.0, 61904.0, 111903.0, 60479.0, 54809.0, 32471.0, 39153.0, 32034.0, 43625.0, 61167.0, 52344.0, 36844.0, 17388.0, 46320.0, 20388.0, 37109.0, 57935.0, 47196.0, 42027.0, 57964.0, 38988.0, 27585.0, 28537.0, 32614.0, 40708.0, 32860.0, 46233.0, 26964.0, 47233.0, 30804.0, 17545.0, 30408.0, 39651.0, 35022.0, 118194.0, 39535.0, 19643.0, 59961.0, 58600.0, 60714.0, 47795.0, 43750.0, 59051.0, 38690.0, 57244.0, 58358.0, 62594.0, 58463.0, 39561.0, 15212.0, 36442.0, 25139.0, 59167.0, 24539.0, 21000.0, 24072.0, 28837.0, 10290.0, 42159.0, 60670.0, 70638.0, 43259.0, 35978.0, 68136.0, 47714.0, 37026.0, 41866.0, 53831.0, 36649.0, 54871.0, 40071.0, 42097.0, 34545.0, 51033.0, 32245.0, 69616.0, 38688.0, 54905.0, 32948.0, 40984.0, 62029.0, 21433.0, 32886.0, 16007.0, 41675.0, 37215.0, 19672.0, 39108.0, 30484.0, 31963.0, 23692.0, 57174.0, 67636.0, 65581.0, 28836.0, 37992.0, 49360.0, 21803.0, 64063.0, 55458.0, 56818.0, 67702.0, 25690.0, 42083.0, 29884.0, 26509.0, 66542.0, 72218.0, 43413.0, 23931.0, 25950.0, 67756.0, 62664.0, 52038.0, 45512.0, 34083.0, 46382.0, 40959.0, 20665.0, 51518.0, 36319.0, 35453.0, 36070.0, 102399.0, 35099.0, 23977.0, 36818.0, 61989.0, 54274.0, 32708.0, 49973.0, 51051.0, 36818.0, 34432.0, 47821.0, 60759.0, 58026.0, 27066.0, 46944.0, 41611.0, 49308.0, 39113.0, 30844.0, 63159.0, 65912.0, 36694.0, 49844.0, 35924.0, 81172.0, 46007.0, 21083.0, 31495.0, 28859.0, 67059.0, 104388.0, 34336.0, 96094.0, 42348.0, 48173.0, 29338.0, 60186.0, 65074.0, 36273.0, 44902.0, 40541.0, 30398.0, 25357.0, 30857.0, 17917.0, 50625.0, 41786.0, 30588.0, 18828.0, 24946.0, 29410.0, 19097.0, 11378.0, 28696.0, 44638.0, 31815.0, 80891.0, 74510.0, 57747.0, 40721.0, 49649.0, 90271.0, 31169.0, 40781.0, 55442.0, 21964.0, 55432.0, 18457.0, 45125.0, 20556.0, 38893.0, 93091.0, 33796.0, 38879.0, 53097.0, 42642.0, 43496.0, 18942.0, 40214.0, 34771.0, 27582.0, 68125.0, 54146.0, 70159.0, 77275.0, 32639.0, 38658.0, 33370.0, 63750.0, 46027.0, 60940.0, 54261.0, 37292.0, 33898.0, 31458.0, 33320.0, 35524.0, 135625.0, 45979.0, 32899.0, 50852.0, 38365.0, 54855.0, 36701.0, 43460.0, 51445.0, 83438.0, 63477.0, 25894.0, 52656.0, 47051.0, 25625.0, 38176.0, 31952.0, 45833.0, 48561.0, 33835.0, 46048.0, 30069.0, 32661.0, 60631.0, 50645.0, 55133.0, 80962.0, 52661.0, 36912.0, 32313.0, 24637.0, 47525.0, 90191.0, 47723.0, 68926.0, 58859.0, 48169.0, 34219.0, 63646.0, 55233.0, 23880.0, 41901.0, 53346.0, 43517.0, 40288.0, 66998.0, 43110.0, 67109.0, 60957.0, 82104.0, 26458.0, 60795.0, 45500.0, 41268.0, 52453.0, 33095.0, 32625.0, 36583.0, 56020.0, 84028.0, 68949.0, 32143.0, 52165.0, 111464.0, 60833.0, 23075.0, 25677.0, 18156.0, 38359.0, 50664.0, 10931.0, 31863.0, 26032.0, 45615.0, 32162.0, 22712.0, 41385.0, 33545.0, 32522.0, 48188.0, 115750.0, 71417.0, 44097.0, 65552.0, 36782.0, 33611.0, 50265.0, 29256.0, 55279.0, 26613.0, 72000.0, 30119.0, 42346.0, 36519.0, 49318.0, 27500.0, 96625.0, 26346.0, 41000.0, 45353.0, 28281.0, 49973.0, 38293.0, 138750.0, 43056.0, 44573.0, 35507.0, 101818.0, 29375.0, 53891.0, 17699.0, 76732.0, 71272.0, 93091.0, 15293.0, 34987.0, 67542.0, 44228.0, 51901.0, 66036.0, 97955.0, 42026.0, 91573.0, 54784.0, 53244.0, 39892.0, 40075.0, 82702.0, 32054.0, 24929.0, 46519.0, 33750.0, 56875.0, 29707.0, 45208.0, 18833.0, 56698.0, 48735.0, 38608.0, 79844.0, 42759.0, 48077.0, 55093.0, 54329.0, 59435.0, 31898.0, 70469.0, 46007.0, 83258.0, 56458.0, 54219.0, 25792.0, 19031.0, 34432.0, 49076.0, 48635.0, 33028.0, 42782.0, 79821.0, 28537.0, 42484.0, 26970.0, 41875.0, 35524.0, 47174.0, 32071.0, 84743.0, 41767.0, 77813.0, 74347.0, 83325.0, 38078.0, 25093.0, 49097.0, 51355.0, 25323.0, 71929.0, 38958.0, 35780.0, 41571.0, 27552.0, 36642.0, 44247.0, 34339.0, 75050.0, 17025.0, 21468.0, 19732.0, 53941.0, 47350.0, 26082.0, 27409.0, 21378.0, 20844.0, 81064.0, 57500.0, 22545.0, 66786.0, 39495.0, 48198.0, 32708.0, 25688.0, 51518.0, 53089.0, 42282.0, 46740.0, 40000.0, 57256.0, 63444.0, 40404.0, 41265.0, 26250.0, 142500.0, 51480.0, 19988.0, 102938.0, 62817.0, 81996.0, 65759.0, 27418.0, 35608.0, 38200.0, 63052.0, 88940.0], 'poverty_rate': [14.1, 28.8, 14.6, 11.7, 1.9, 58.0, 17.2, 12.2, 37.7, 18.4, 9.2, 4.4, 13.1, 26.0, 36.3, 42.4, 20.5, 11.6, 6.4, 12.7, 10.3, 36.5, 24.4, 20.3, 24.8, 5.4, 17.4, 18.2, 58.1, 24.1, 41.3, 18.9, 8.9, 9.5, 9.3, 18.6, 27.8, 37.4, 35.9, 15.6, 20.5, 25.1, 17.1, 26.3, 20.6, 36.2, 41.4, 28.7, 25.8, 19.1, 11.9, 14.1, 32.8, 10.2, 9.5, 13.2, 21.6, 16.3, 7.7, 23.6, 9.5, 5.0, 14.4, 8.6, 7.8, 50.7, 25.8, 34.2, 10.6, 46.3, 47.4, 40.9, 32.2, 79.2, 14.4, 10.9, 10.9, 18.2, 31.0, 12.2, 11.6, 14.4, 20.5, 19.4, 36.2, 14.8, 20.0, 19.9, 20.1, 16.5, 21.5, 3.0, 18.0, 9.4, 30.5, 15.7, 10.9, 51.0, 33.4, 46.7, 18.4, 26.9, 42.4, 14.3, 25.7, 26.2, 50.6, 8.5, 11.2, 7.4, 34.7, 8.7, 12.9, 43.1, 8.3, 7.3, 24.3, 6.3, 26.7, 38.3, 26.9, 36.7, 10.8, 4.4, 17.4, 40.1, 39.4, 8.5, 9.1, 10.0, 20.7, 19.3, 14.8, 21.8, 44.5, 11.3, 22.9, 26.0, 28.9, 1.8, 15.4, 37.5, 21.7, 7.6, 10.1, 32.0, 9.2, 11.1, 21.7, 26.7, 16.3, 18.0, 17.8, 39.9, 23.2, 25.7, 12.5, 16.3, 23.4, 11.0, 11.3, 20.1, 23.6, 19.9, 14.6, 14.1, 39.1, 23.0, 36.6, 7.7, 1.3, 20.4, 7.5, 20.1, 8.3, 31.3, 15.8, 8.8, 19.2, 6.6, 13.3, 42.0, 37.4, 16.1, 45.4, 19.4, 28.3, 24.6, 37.6, 31.2, 30.7, 40.0, 54.2, 33.7, 18.3, 34.8, 4.0, 7.7, 9.5, 15.4, 16.4, 8.6, 21.1, 20.2, 12.4, 48.4, 17.4, 68.2, 14.1, 57.1, 17.6, 9.3, 17.2, 11.3, 11.6, 13.4, 28.1, 46.2, 25.7, 24.9, 33.2, 7.7, 8.1, 7.3, 7.9, 24.1, 32.6, 26.0, 16.6, 11.3, 13.9, 11.8, 20.9, 26.4, 32.9, 36.1, 39.7, 1.1, 13.6, 31.4, 15.2, 21.6, 7.3, 24.1, 16.0, 18.4, 7.1, 15.3, 42.0, 15.0, 22.6, 36.4, 16.0, 29.3, 23.5, 20.1, 13.6, 11.5, 35.2, 21.5, 14.1, 11.8, 13.0, 6.6, 13.4, 26.0, 22.4, 48.9, 18.1, 4.6, 19.1, 6.6, 9.1, 20.3, 17.6, 6.0, 13.0, 36.4, 33.3, 8.5, 17.0, 17.9, 6.4, 15.1, 4.5, 12.4, 14.5, 27.4, 6.0, 10.3, 20.2, 8.2, 38.7, 30.5, 14.8, 8.8, 3.5, 9.5, 24.4, 6.5, 7.7, 14.7, 50.6, 38.2, 48.9, 18.7, 10.8, 69.4, 33.8, 39.1, 8.9, 34.3, 51.4, 29.1, 30.1, 18.1, 31.1, 8.6, 3.3, 20.5, 8.9, 18.7, 29.6, 15.4, 31.5, 12.0, 26.5, 5.4, 28.2, 11.2, 15.5, 12.6, 42.7, 3.0, 33.1, 19.1, 11.2, 27.4, 9.2, 23.9, 5.6, 18.5, 14.1, 16.7, 1.5, 31.3, 6.9, 57.1, 8.7, 5.2, 9.3, 54.6, 22.1, 25.5, 29.4, 22.4, 4.7, 6.0, 24.5, 5.6, 9.7, 6.3, 32.2, 34.3, 6.9, 34.0, 45.3, 8.7, 26.7, 8.0, 36.6, 21.7, 49.9, 11.5, 10.0, 10.4, 3.2, 20.5, 16.0, 23.1, 8.6, 11.5, 21.8, 10.8, 18.2, 7.4, 11.2, 16.4, 38.5, 47.1, 26.7, 18.8, 18.4, 30.2, 17.4, 2.9, 35.9, 16.2, 39.3, 22.9, 39.7, 10.6, 30.2, 7.3, 17.1, 5.3, 7.1, 6.8, 17.0, 37.5, 19.5, 15.2, 20.1, 19.2, 23.0, 23.2, 16.8, 31.2, 24.5, 11.0, 26.6, 14.3, 51.8, 53.8, 40.3, 4.5, 7.5, 42.5, 25.1, 39.8, 50.8, 4.4, 13.8, 44.1, 5.5, 18.4, 8.4, 32.0, 26.6, 14.0, 13.3, 24.3, 15.5, 20.7, 9.6, 11.0, 19.9, 12.5, 33.7, 1.9, 6.6, 44.1, 11.2, 4.0, 3.0, 7.3, 35.2, 27.3, 28.5, 23.9, 6.1], 'unemployment_rate': [0.097686375, 0.065723794, 0.166293142, 0.124827269, 0.063549832, 0.073651452, 0.131461131, 0.094346979, 0.140832976, 0.174167417, 0.041085271, 0.057580779, 0.054470101, 0.067321178, 0.088225858, 0.229482072, 0.011916111, 0.040850588, 0.063268366, 0.115890508, 0.035221496, 0.178185745, 0.262976968, 0.011335013, 0.131158917, 0.087385483, 0.098980204, 0.176148796, 0.14461316, 0.17323741, 0.22039801, 0.218520333, 0.063658099, 0.133676093, 0.206855081, 0.170409511, 0.11037302, 0.123766135, 0.131743119, 0.055732484, 0.150121065, 0.142746615, 0.115461847, 0.105963791, 0.123624444, 0.109816972, 0.23108747, 0.195510204, 0.076500588, 0.042686101, 0.019665683, 0.080136986, 0.204280156, 0.047407913, 0.095137421, 0.12679524, 0.150479846, 0.125765426, 0.044583333, 0.214183381, 0.041356877, 0.110323438, 0.055155875, 0.053564237, 0.081150488, 0.348008386, 0.103244838, 0.312611012, 0.099182004, 0.258064516, 0.155444722, 0.062886598, 0.214501511, 0.439590444, 0.095290859, 0.107042254, 0.032068063, 0.092469018, 0.138262782, 0.050383481, 0.103721571, 0.13483871, 0.071107364, 0.068076536, 0.034616881, 0.140276302, 0.149261335, 0.159026599, 0.106880138, 0.025311025, 0.144497608, 0.079104478, 0.131736527, 0.12539185, 0.093378608, 0.188067445, 0.1, 0.309882747, 0.203271028, 0.348777349, 0.148903424, 0.166843783, 0.091570649, 0.155357805, 0.079276773, 0.131071191, 0.151145038, 0.038598999, 0.145936982, 0.034010601, 0.11886697, 0.037341299, 0.158176944, 0.192203083, 0.071680376, 0.068592058, 0.11815301, 0.035865793, 0.116172169, 0.057540884, 0.160730056, 0.176021554, 0.056382146, 0.109368376, 0.102382486, 0.172051696, 0.018193225, 0.090425532, 0.107110979, 0.024411135, 0.175749894, 0.111002921, 0.0509487, 0.087258687, 0.125672372, 0.104347826, 0.105180534, 0.131529264, 0.121461408, 0.058623619, 0.09619801, 0.145048815, 0.216194332, 0.160571809, 0.067278287, 0.216848674, 0.092148913, 0.032626816, 0.216194332, 0.080686695, 0.059301769, 0.053372149, 0.05323741, 0.12, 0.135651629, 0.065989848, 0.078817734, 0.133622126, 0.206338726, 0.082673703, 0.086558761, 0.078163166, 0.086389961, 0.163898117, 0.081424936, 0.138454667, 0.254367575, 0.090163934, 0.091334895, 0.096795291, 0.049786629, 0.086882453, 0.057553957, 0.075280112, 0.073079325, 0.04467354, 0.108825481, 0.086255656, 0.114788437, 0.066384181, 0.093187661, 0.171334432, 0.12745682, 0.096869245, 0.205128205, 0.100585418, 0.104712042, 0.195104392, 0.507614213, 0.203891051, 0.153279786, 0.260663507, 0.305194805, 0.19297235, 0.03653323, 0.097790055, 0.092042385, 0.041666667, 0.09765625, 0.139391056, 0.065677966, 0.066012002, 0.119248218, 0.187595323, 0.08035982, 0.27734375, 0.12704918, 0.422321429, 0.108317215, 0.20361991, 0.061612903, 0.066434996, 0.089311334, 0.115929459, 0.092623405, 0.063731932, 0.11313083, 0.132231405, 0.105973025, 0.191593353, 0.096566524, 0.018841912, 0.140740741, 0.110093792, 0.063364345, 0.151768733, 0.133175195, 0.145665323, 0.044805195, 0.072277228, 0.030340815, 0.096314908, 0.151329243, 0.082046758, 0.137774413, 0.140606992, 0.149219467, 0.021902017, 0.116955446, 0.091877986, 0.114509804, 0.170554692, 0.050728277, 0.106899903, 0.119515253, 0.096503497, 0.067204301, 0.085316847, 0.086378738, 0.102047449, 0.07388664, 0.106456044, 0.129227053, 0.087265136, 0.160147262, 0.151374509, 0.08816521, 0.095054592, 0.127546072, 0.159594096, 0.099892819, 0.176044568, 0.05121876, 0.120577121, 0.118041583, 0.043478261, 0.085856304, 0.262736536, 0.106712565, 0.054535801, 0.273263434, 0.065811966, 0.059414226, 0.1340882, 0.104332953, 0.039571006, 0.107897153, 0.232041049, 0.105769231, 0.069218871, 0.136045259, 0.115207373, 0.063839559, 0.125633232, 0.096800997, 0.03559965, 0.100581395, 0.13706706, 0.091408935, 0.075596817, 0.129310345, 0.116955017, 0.201671309, 0.102179837, 0.095274683, 0.135547919, 0.120465116, 0.049460432, 0.099949006, 0.133264463, 0.051483733, 0.164906988, 0.157422081, 0.224820144, 0.223255814, 0.095988539, 0.09905795, 0.028318584, 0.238070806, 0.19002079, 0.098895582, 0.112596554, 0.294452347, 0.235502122, 0.119607843, 0.140121439, 0.107025846, 0.050441655, 0.069385271, 0.059773829, 0.086549063, 0.088392857, 0.117797332, 0.053853296, 0.251207729, 0.138111888, 0.166007905, 0.045591398, 0.108664773, 0.110402355, 0.137201979, 0.151676206, 0.121156494, 0.050305914, 0.063807531, 0.11381323, 0.119982921, 0.133171913, 0.092148913, 0.172646427, 0.016203704, 0.02987013, 0.08040201, 0.134320175, 0.056978002, 0.127948113, 0.033260234, 0.206933333, 0.04654387, 0.047184774, 0.066434996, 0.324444444, 0.171932403, 0.103303862, 0.265224111, 0.123324397, 0.093385214, 0.138940153, 0.053399923, 0.108266073, 0.077569308, 0.094994312, 0.083946344, 0.11842919, 0.049067982, 0.066425993, 0.258571429, 0.112132353, 0.08373079, 0.066806576, 0.139742873, 0.074115665, 0.259259259, 0.113105925, 0.064629434, 0.045649073, 0.095238095, 0.0830373, 0.138248848, 0.117837838, 0.051835853, 0.081466763, 0.083866837, 0.065487392, 0.177073171, 0.081118881, 0.11952862, 0.081262592, 0.218400688, 0.127254509, 0.080686695, 0.078510317, 0.12814412, 0.212271153, 0.057938719, 0.06846473, 0.131743119, 0.149595213, 0.122121424, 0.140275387, 0.149219467, 0.108108108, 0.118733509, 0.069404151, 0.115249119, 0.097529259, 0.071646341, 0.085368162, 0.168279344, 0.152272727, 0.078651685, 0.135890272, 0.231788079, 0.090909091, 0.101226994, 0.052918942, 0.109414758, 0.138238573, 0.12909699, 0.098382749, 0.109457093, 0.075431034, 0.094752187, 0.181212525, 0.177252585, 0.134502924, 0.068774265, 0.289340102, 0.268621236, 0.448074679, 0.299757282, 0.046353872, 0.015197568, 0.081601232, 0.028415961, 0.064193168, 0.066055046, 0.216848674, 0.12590799, 0.053739612, 0.055254849, 0.197698745, 0.055140187, 0.05624297, 0.06899401, 0.065342729, 0.055735771, 0.023561091, 0.066431095, 0.045, 0.028934368, 0.215909091, 0.027574564, 0.034519957, 0.035916061, 0.14086629, 0.152046784, 0.133650291, 0.256149733, 0.069601428, 0.0809121], 'uni_education_25+': [0.168509509, 0.111402359, 0.147312269, 0.050132928, 0.403954214, 0.102955195, 0.20380117, 0.090437601, 0.047601339, 0.102691511, 0.100328947, 0.527176781, 0.345857854, 0.568033429, 0.226814777, 0.3805374, 0.424964937, 0.552548489, 0.40952621, 0.349884906, 0.258886442, 0.070931245, 0.071504237, 0.1694018, 0.125731679, 0.284854246, 0.179372197, 0.15356292, 0.047239915, 0.117980072, 0.182336182, 0.140077821, 0.422256775, 0.268161872, 0.172319475, 0.565535024, 0.172743574, 0.100675676, 0.057256583, 0.100468284, 0.192909897, 0.035338785, 0.205354678, 0.096564885, 0.06139805, 0.022668394, 0.129396985, 0.170362358, 0.162601626, 0.139616613, 0.828070175, 0.175059952, 0.083226633, 0.171770432, 0.226443265, 0.662311147, 0.151658768, 0.015885947, 0.380767739, 0.198357549, 0.240897389, 0.165820137, 0.510619469, 0.214598953, 0.358902001, 0.061581248, 0.211139241, 0.035820896, 0.520915354, 0.065584416, 0.070175439, 0.078923358, 0.106990014, 0.060441941, 0.198029891, 0.146116241, 0.388998035, 0.213943194, 0.130825139, 0.479000583, 0.195180723, 0.167398946, 0.25940902, 0.113879004, 0.674125874, 0.200720072, 0.202439778, 0.380490588, 0.109860116, 0.268360599, 0.013547237, 0.423807081, 0.142030276, 0.201200343, 0.10933759, 0.16084788, 0.392834891, 0.014117647, 0.081980519, 0.091324201, 0.162518302, 0.207425343, 0.26719057, 0.258240183, 0.261888814, 0.132780083, 0.026600166, 0.526623377, 0.212507778, 0.267043669, 0.202991453, 0.141363636, 0.147076372, 0.123522459, 0.382333768, 0.285611251, 0.165626027, 0.283661878, 0.12675, 0.14025974, 0.182923381, 0.102324177, 0.385287202, 0.240339473, 0.056138934, 0.029108327, 0.108970831, 0.168076923, 0.348542762, 0.505309505, 0.048747913, 0.197846568, 0.176186645, 0.10559723, 0.138646288, 0.105422829, 0.095789972, 0.171848739, 0.142857143, 0.41799308, 0.117877423, 0.088550247, 0.139520776, 0.163655685, 0.345549738, 0.08590604, 0.315638907, 0.34819491, 0.139520776, 0.408774373, 0.097701149, 0.170479474, 0.243867655, 0.13821938, 0.084254483, 0.030701754, 0.27692788, 0.103164283, 0.093983992, 0.448705012, 0.442805539, 0.15942482, 0.141213064, 0.217720392, 0.168716372, 0.161811162, 0.036792453, 0.362808843, 0.358885017, 0.527820122, 0.596791444, 0.117714286, 0.540820096, 0.131186929, 0.251100352, 0.294754572, 0.237702807, 0.307383628, 0.158741259, 0.085993241, 0.160032167, 0.039807524, 0.068254695, 0.125579342, 0.103820598, 0.168669131, 0.22823219, 0.149602386, 0.029233871, 0.092969204, 0.171372292, 0.101298701, 0.095599393, 0.045287638, 0.638549618, 0.162665563, 0.495871946, 0.207537688, 0.16256457, 0.324362111, 0.138937031, 0.482361963, 0.319685039, 0.378757515, 0.106167401, 0.120772947, 0.15408805, 0.079066753, 0.200268817, 0.087719298, 0.199338135, 0.487170943, 0.111002445, 0.136934307, 0.276122083, 0.243725869, 0.164427727, 0.066834805, 0.061827957, 0.28164794, 0.142857143, 0.328571429, 0.225638353, 0.313166605, 0.424920803, 0.109768379, 0.38185567, 0.06088993, 0.779063361, 0.19303675, 0.224592221, 0.441001565, 0.080025472, 0.166790767, 0.132464712, 0.058467131, 0.244320298, 0.755110384, 0.120423467, 0.174675128, 0.497148004, 0.368347987, 0.507961165, 0.206730769, 0.148913897, 0.355088496, 0.427527406, 0.347386588, 0.234789009, 0.169544297, 0.207895842, 0.390316206, 0.169018933, 0.050646175, 0.144635049, 0.084873066, 0.213095586, 0.131664853, 0.146364057, 0.145865434, 0.247864986, 0.064474254, 0.245041426, 0.350638761, 0.198295641, 0.117073171, 0.247985121, 0.102930128, 0.161686451, 0.458288579, 0.101003764, 0.400197954, 0.172615185, 0.263902439, 0.100755668, 0.368676546, 0.190435887, 0.105285592, 0.105675147, 0.269216758, 0.17954453, 0.144492132, 0.241391224, 0.090463918, 0.294627383, 0.199397288, 0.470207254, 0.174307036, 0.236224029, 0.140482128, 0.076845638, 0.16485773, 0.10056391, 0.083578792, 0.153032832, 0.174886536, 0.20610687, 0.300439399, 0.110704111, 0.160841534, 0.824971165, 0.176865936, 0.126103405, 0.085378869, 0.177067083, 0.190532081, 0.188659579, 0.579006772, 0.112681913, 0.026403743, 0.085796683, 0.040115301, 0.077979132, 0.101457097, 0.202453988, 0.088607595, 0.475305216, 0.794069862, 0.238783649, 0.518049398, 0.318350079, 0.153225806, 0.228324505, 0.493210587, 0.08121547, 0.11350548, 0.105626851, 0.182048498, 0.155529618, 0.1640178, 0.271408351, 0.292464115, 0.062254902, 0.431638418, 0.106725146, 0.143147897, 0.105032823, 0.294513956, 0.315638907, 0.114899926, 0.716906946, 0.122131148, 0.125871172, 0.158213475, 0.556167665, 0.042051282, 0.543604651, 0.035050676, 0.212288574, 0.355059417, 0.487170943, 0.039319872, 0.211460151, 0.560435572, 0.049474494, 0.253384913, 0.364356436, 0.512849414, 0.136064165, 0.350836333, 0.231973313, 0.351817622, 0.112262522, 0.075572519, 0.622360248, 0.284542314, 0.036484245, 0.264764622, 0.068349515, 0.150948367, 0.068331143, 0.240572172, 0.09653092, 0.107372482, 0.163523637, 0.366545265, 0.474940334, 0.128080808, 0.247411444, 0.070159027, 0.170081392, 0.428831012, 0.118260244, 0.204924761, 0.086883596, 0.252503954, 0.173560108, 0.313959028, 0.065922921, 0.088779956, 0.408774373, 0.13387151, 0.077154583, 0.11542814, 0.206791467, 0.411525586, 0.057256583, 0.141590679, 0.201408451, 0.039349224, 0.244320298, 0.164179104, 0.06231454, 0.636127355, 0.156238291, 0.211101996, 0.454371585, 0.502911679, 0.068518038, 0.070552147, 0.080141129, 0.185093874, 0.272237197, 0.227392739, 0.206444566, 0.405676127, 0.223813112, 0.39089969, 0.131484335, 0.140836771, 0.142972319, 0.22251773, 0.106906339, 0.120189773, 0.066876475, 0.151760228, 0.166792169, 0.092167454, 0.166768728, 0.0675, 0.05115346, 0.341968068, 0.072751323, 0.110399211, 0.496179039, 0.091157703, 0.306578153, 0.08590604, 0.170926518, 0.158820941, 0.744900197, 0.182055101, 0.127942064, 0.163706564, 0.19408867, 0.296017223, 0.362382445, 0.229678912, 0.122007366, 0.669916938, 0.225789048, 0.09294998, 0.71127026, 0.169803601, 0.627631579, 0.236107027, 0.12055336, 0.174524982, 0.072764228, 0.396475771, 0.435773284]}
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
### Requirement FR4 - Develop a function to calculate the Spearman’s Rank Correlation Coefficient for two named columns
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:code id: tags:
```
python
def
rank_list
(
lst
):
"""
This function returns a list of ranks for the input list, taking duplicates into account.
:param lst: A list of data that needed to be ranked
:return list: A of ranked values
"""
ranks
=
{}
for
i
,
val
in
enumerate
(
sorted
(
lst
),
1
):
ranks
.
setdefault
(
val
,
[]).
append
(
i
)
# get the average rank of each item using dictionary comprehension
avg_ranks
=
{
v
:
sum
(
r
)
/
len
(
r
)
for
v
,
r
in
ranks
.
items
()}
ranked_list
=
[
avg_ranks
[
val
]
for
val
in
lst
]
return
ranked_list
return
[
avg_ranks
[
val
]
for
val
in
lst
]
def
sm_correlation_coefficient
(
data1
,
data2
):
"""
This function will accept two list as parameter and will return Spear-man
'
s Rank Correlation Coefficient
:param data1: A column data as a list from csv file
:param data2: A column data as a list from csv file
:return: float: The Spear-man
'
s Rank Correlation Coefficient
"""
# raise an error if list sizes are not equal
if
len
(
data1
)
!=
len
(
data2
):
raise
ValueError
(
"
Both lists must have the same length.
"
)
ranked_data1
=
rank_list
(
data1
)
ranked_data2
=
rank_list
(
data2
)
# get the sum of squared differences of each item in both lists
sum_sqr_diff
=
0
for
i
in
range
(
len
(
ranked_data1
)):
diff
=
ranked_data1
[
i
]
-
ranked_data2
[
i
]
# differences of each list item
sqr
=
diff
**
2
# squared differences
sum_sqr_diff
+=
sqr
# get the sum of each squared differences
# Calculate the Spear-man's Rank Correlation Coefficient using the formula
n
=
len
(
data1
)
correlation
=
1
-
(
6
*
sum_sqr_diff
)
/
(
n
*
(
n
**
2
-
1
))
correlation
_coefficient
=
1
-
(
6
*
sum_sqr_diff
)
/
(
n
*
(
n
**
2
-
1
))
return
correlation
return
correlation
_coefficient
# Read two columns of data from the CSV file
file_path
=
'
task1.csv
'
column1_name
,
column1_data
=
read_csv_column
(
file_path
,
0
,
True
)
column2_name
,
column2_data
=
read_csv_column
(
file_path
,
1
,
True
)
# Calculate the Spear-man's Rank Correlation Coefficient for the two columns
try
:
coefficient
=
sm_correlation_coefficient
(
column1_data
,
column2_data
)
print
(
f
"
Spear-man
'
s Rank Correlation Coefficient for `
{
column1_name
}
` and `
{
column2_name
}
`:
{
coefficient
}
"
)
except
ValueError
as
e
:
print
(
f
"
Error occured:
{
e
}
"
)
```
%% Output
Spear-man's Rank Correlation Coefficient for `age` and `pop`: 0.008388522728803749
%% Cell type:markdown id: tags:
### Requirement FR5 - Develop a function to generate a set of Spearman’s Rank Correlation Coefficients for a given data file
%% Cell type:code id: tags:
```
python
def
generate_correlation_coefficients
(
csv_file_path
):
def
generate_
all_
correlation_coefficients
(
csv_file_path
):
# Read the data from the CSV file
con
_flag
s
=
[
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
]
column_data
=
read_all_csv_data
(
csv_file_path
,
con
_flag
s
)
con
version_indicator
s
=
[
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
]
all_
column_data
=
read_all_csv_data
(
csv_file_path
,
con
version_indicator
s
)
# Get the column names
column_names
=
list
(
column_data
.
keys
())
column_names
=
list
(
all_
column_data
.
keys
())
# Initialize an empty list to store the correlation coefficients
correlation_coefficients
=
[]
all_
correlation_coefficients
=
[]
# Iterate through all pairs of columns
for
i
in
range
(
len
(
column_names
)):
for
j
in
range
(
len
(
column_names
)):
if
i
==
j
:
continue
# skip the comparison of the same column with itself
col1_name
=
column_names
[
i
]
col1_data
=
column_data
[
col1_name
]
col1_data
=
all_
column_data
[
col1_name
]
col2_name
=
column_names
[
j
]
col2_data
=
column_data
[
col2_name
]
col2_data
=
all_
column_data
[
col2_name
]
# Calculate the Spearman's Rank Correlation Coefficient for the current pair of columns
try
:
coefficient
=
sm_correlation_coefficient
(
col1_data
,
col2_data
)
correlation_coefficients
.
append
((
col1_name
,
col2_name
,
coefficient
))
sm_cor_
coefficient
=
sm_correlation_coefficient
(
col1_data
,
col2_data
)
all_
correlation_coefficients
.
append
((
col1_name
,
col2_name
,
sm_cor_
coefficient
))
except
ValueError
as
e
:
print
(
f
"
Error occured:
{
e
}
"
)
print
(
f
"
A value error occurred:
{
e
}
"
)
except
Exception
as
ex
:
print
(
f
"
An error occurred:
{
ex
}
"
)
return
correlation_coefficients
return
all_
correlation_coefficients
# Test the generate_correlation_coefficients function
file_path
=
'
task1.csv
'
result
=
generate_correlation_coefficients
(
file_path
)
result
=
generate_
all_
correlation_coefficients
(
file_path
)
print
(
result
)
```
%% Output
[('age', 'pop', 0.008388522728803749), ('age', 'share_white', 0.2207405157324991), ('age', 'share_black', -0.10335098740738657), ('age', 'share_hispanic', -0.14877212526226957), ('age', 'personal_income', 0.061421540828312526), ('age', 'household_income', 0.06422180808910982), ('age', 'poverty_rate', -0.12141944634635382), ('age', 'unemployment_rate', -0.09615083822147863), ('age', 'uni_education_25+', 0.028563528332461674), ('pop', 'age', 0.008388522728803749), ('pop', 'share_white', 0.07665516130573191), ('pop', 'share_black', -0.13387812319718395), ('pop', 'share_hispanic', 0.1278109846392408), ('pop', 'personal_income', 0.2209602832327533), ('pop', 'household_income', 0.31369475803834), ('pop', 'poverty_rate', -0.28695045876503955), ('pop', 'unemployment_rate', -0.15865296638662674), ('pop', 'uni_education_25+', 0.12468582770619929), ('share_white', 'age', 0.2207405157324991), ('share_white', 'pop', 0.07665516130573191), ('share_white', 'share_black', -0.4916674832288337), ('share_white', 'share_hispanic', -0.520439020566343), ('share_white', 'personal_income', 0.40540064010308285), ('share_white', 'household_income', 0.3733566278105559), ('share_white', 'poverty_rate', -0.47754993992143846), ('share_white', 'unemployment_rate', -0.3814682441014612), ('share_white', 'uni_education_25+', 0.3622678768934545), ('share_black', 'age', -0.10335098740738657), ('share_black', 'pop', -0.13387812319718395), ('share_black', 'share_white', -0.4916674832288337), ('share_black', 'share_hispanic', -0.17341998282769766), ('share_black', 'personal_income', -0.2556799656064015), ('share_black', 'household_income', -0.3599164228207896), ('share_black', 'poverty_rate', 0.3433366996108673), ('share_black', 'unemployment_rate', 0.33669382348293975), ('share_black', 'uni_education_25+', -0.11787955748863044), ('share_hispanic', 'age', -0.14877212526226957), ('share_hispanic', 'pop', 0.1278109846392408), ('share_hispanic', 'share_white', -0.520439020566343), ('share_hispanic', 'share_black', -0.17341998282769766), ('share_hispanic', 'personal_income', -0.12611993542626387), ('share_hispanic', 'household_income', -0.022889166383932125), ('share_hispanic', 'poverty_rate', 0.16351308316318214), ('share_hispanic', 'unemployment_rate', 0.04988391548091631), ('share_hispanic', 'uni_education_25+', -0.17818345947177416), ('personal_income', 'age', 0.061421540828312526), ('personal_income', 'pop', 0.2209602832327533), ('personal_income', 'share_white', 0.40540064010308285), ('personal_income', 'share_black', -0.2556799656064015), ('personal_income', 'share_hispanic', -0.12611993542626387), ('personal_income', 'household_income', 0.8582992010347475), ('personal_income', 'poverty_rate', -0.8161829964810254), ('personal_income', 'unemployment_rate', -0.544004851604116), ('personal_income', 'uni_education_25+', 0.6920090613903686), ('household_income', 'age', 0.06422180808910982), ('household_income', 'pop', 0.31369475803834), ('household_income', 'share_white', 0.3733566278105559), ('household_income', 'share_black', -0.3599164228207896), ('household_income', 'share_hispanic', -0.022889166383932125), ('household_income', 'personal_income', 0.8582992010347475), ('household_income', 'poverty_rate', -0.8737056162737573), ('household_income', 'unemployment_rate', -0.5471233331414411), ('household_income', 'uni_education_25+', 0.6216765103235913), ('poverty_rate', 'age', -0.12141944634635382), ('poverty_rate', 'pop', -0.28695045876503955), ('poverty_rate', 'share_white', -0.47754993992143846), ('poverty_rate', 'share_black', 0.3433366996108673), ('poverty_rate', 'share_hispanic', 0.16351308316318214), ('poverty_rate', 'personal_income', -0.8161829964810254), ('poverty_rate', 'household_income', -0.8737056162737573), ('poverty_rate', 'unemployment_rate', 0.5513979748441693), ('poverty_rate', 'uni_education_25+', -0.5824024626698399), ('unemployment_rate', 'age', -0.09615083822147863), ('unemployment_rate', 'pop', -0.15865296638662674), ('unemployment_rate', 'share_white', -0.3814682441014612), ('unemployment_rate', 'share_black', 0.33669382348293975), ('unemployment_rate', 'share_hispanic', 0.04988391548091631), ('unemployment_rate', 'personal_income', -0.544004851604116), ('unemployment_rate', 'household_income', -0.5471233331414411), ('unemployment_rate', 'poverty_rate', 0.5513979748441693), ('unemployment_rate', 'uni_education_25+', -0.5366899652267001), ('uni_education_25+', 'age', 0.028563528332461674), ('uni_education_25+', 'pop', 0.12468582770619929), ('uni_education_25+', 'share_white', 0.3622678768934545), ('uni_education_25+', 'share_black', -0.11787955748863044), ('uni_education_25+', 'share_hispanic', -0.17818345947177416), ('uni_education_25+', 'personal_income', 0.6920090613903686), ('uni_education_25+', 'household_income', 0.6216765103235913), ('uni_education_25+', 'poverty_rate', -0.5824024626698399), ('uni_education_25+', 'unemployment_rate', -0.5366899652267001)]
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
### Requirement FR6 - Develop a function to print a custom table
%% Cell type:code id: tags:
```
python
# replace with your code
def
print_table
(
correlations
,
border_char
,
columns
):
# Find the length of the longest string in the list and add constant to define cell length
longest_string_length
=
len
(
max
(
columns
,
key
=
len
))
max_cell_length
=
longest_string_length
+
5
# print top boarder
# Initialize a variable to hold the sum of string lengths starts with 1 to hold the cell gap.
sum_col_lengths
=
1
# Loop over each string in the list and add its length to the running total
for
name
in
columns
:
sum_col_lengths
+=
len
(
name
)
sum_col_lengths
+=
len
(
columns
)
*
7
print
(
"
"
*
max_cell_length
+
"
$
"
*
sum_col_lengths
)
# print the column names
print
(
"
"
*
max_cell_length
,
end
=
""
)
for
name
in
columns
:
print
(
border_char
+
"
"
*
3
+
name
+
"
"
*
3
,
end
=
""
)
print
(
"
$
"
)
# print header separator
print
(
"
$
"
*
(
max_cell_length
+
sum_col_lengths
))
# print the correlation coefficients
for
i
,
value
in
enumerate
(
columns
):
string_len_diff
=
longest_string_length
-
len
(
value
)
+
5
space_count
=
int
(
string_len_diff
/
2
)
if
len
(
value
)
%
2
==
0
:
print
(
border_char
+
space_count
*
"
"
+
value
+
(
space_count
-
1
)
*
"
"
,
end
=
""
)
else
:
print
(
border_char
+
space_count
*
"
"
+
value
+
space_count
*
"
"
,
end
=
""
)
for
col_name
in
columns
:
if
value
==
col_name
:
cell_space
=
int
(((
len
(
col_name
)
+
7
)
/
2
)
-
1
)
*
"
"
print
(
border_char
+
cell_space
+
"
-
"
+
cell_space
,
end
=
""
)
else
:
for
element
in
correlations
:
if
element
[
0
]
==
value
and
element
[
1
]
==
col_name
:
correlation_coefficient
=
round
(
element
[
2
],
4
)
cell_space
=
(
len
(
col_name
))
//
2
*
"
"
if
correlation_coefficient
>
0
:
print
(
border_char
+
"
"
+
cell_space
+
str
(
correlation_coefficient
)
+
cell_space
,
end
=
""
)
else
:
print
(
border_char
+
cell_space
+
str
(
correlation_coefficient
)
+
cell_space
,
end
=
""
)
print
(
"
$
"
)
# print footer
# print header separator
print
(
"
$
"
*
(
max_cell_length
+
sum_col_lengths
))
file_path
=
'
task1.csv
'
columns_to_include
=
[
'
age
'
,
'
pop
'
,
'
share_white
'
,
'
share_black
'
]
print_table
(
generate_all_correlation_coefficients
(
file_path
),
'
$
'
,
columns_to_include
)
```
%% Output
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ age $ pop $ share_white $ share_black $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ age $ - $ 0.0084 $ 0.2207 $ -0.1034 $
$ pop $ 0.0084 $ - $ 0.0767 $ -0.1339 $
$ share_white $ 0.2207 $ 0.0767 $ - $ -0.4917 $
$ share_black $ -0.1034 $ -0.1339 $ -0.4917 $ - $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
# Coding Standards
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
%% Cell type:markdown id: tags:
# Process Development Report for Task B
%% Cell type:markdown id: tags:
add markdown text here
%% Cell type:markdown id: tags:
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
MARK: __%
</p>
<p
style=
"color:red; font-weight:bold; font-size:xx-small"
>
FEEDBACK:
</p>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment