Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
ds_cs4bd_2324
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
s90907
ds_cs4bd_2324
Commits
d4ed443e
Commit
d4ed443e
authored
1 year ago
by
Sven Graupner
Browse files
Options
Downloads
Patches
Plain Diff
update README.md tasks 4 5 median income analysis
parent
acb93f47
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
B_explore_python/README.md
+34
-17
34 additions, 17 deletions
B_explore_python/README.md
with
34 additions
and
17 deletions
B_explore_python/README.md
+
34
−
17
View file @
d4ed443e
...
...
@@ -129,21 +129,22 @@ publishes income statistics by ZIP codes
For example, California ZIP Code
[
93636
](
https://simplemaps.com/us-zips/93636
)
is
a rural agricultural county of Madera,
north of
is
for Madera county, an agricultural region
north of
Fresno in the Central Valley.
Income distribution for the tax year 2020 was:
```
income bracket: number of tax returns
filed in bracket
[$1 to under $25,000]
1,800
[$25,000 to under $50,000]
1,380
[$50,000 to under $75,000]
980
[$75,000 to under $100,000]
830
[$100,000 to under $200,000]
1,660
[$200,000 or more
<
$
5
0M
>]
550
[$1 to under $25,000] 1,800
[$25,000 to under $50,000] 1,380
[$50,000 to under $75,000] 980
[$75,000 to under $100,000] 830
[$100,000 to under $200,000] 1,660
[$200,000 or more
, up to
$
1
0M
]
550
```
Numbers mean that 980 tax returns were filed in the
bracket [$50,000 to under $75,000] taxable income.
bracket [$50,000 to under $75,000] taxable income,
which is [50,000 .. 74,999].
A common statistical analysis is to compute:
...
...
@@ -151,8 +152,14 @@ A common statistical analysis is to compute:
-
the
*median income*
per tax filer.
Assume $50 million as upper limit for
*"more"*
in the
highest bracket.
Assume $10 million ($10M) as upper limit for
*"or more"*
in
the highest bracket.
For calculating the
*mean income*
, use the mean income
within each bracket.
For calculating the
*median income*
, consider a linear rising
income from the lower bound to the upper bound in each bracket.
Answer questions:
...
...
@@ -160,11 +167,11 @@ Answer questions:
*median*
calculations? (1 Pt)
-
Why are both indicators relevant?
1.
Calculate manually the
*average*
income for Madera
county.
(1 Pt)
1.
Calculate manually the
*average*
income for Madera
county.
(1 Pt)
1.
Calculate manually the
*median*
income for Madera
county.
(1 Pt)
1.
Calculate manually the
*median*
income for Madera
county.
(1 Pt)
...
...
@@ -172,7 +179,8 @@ Answer questions:
Write Python code to perform this income analysis.
<b>
Use pure Python
</b>
(no
*Pandas*
nor
*Numpy*
) for this simple example.
<b>
Use pure Python
</b>
, no libraries such as
*Pandas*
or
*Numpy*
or
library functions for
*mean*
and
*median*
.
Think about following steps:
...
...
@@ -189,15 +197,24 @@ Think about following steps:
1.
Define function
`number_of_returns(...)`
.
1.
Implement functions and demonstrate they return correct values.
(4 Pts)
1.
Implement functions and demonstrate they return correct values.
1.
Demonstrate analysis for other ZIP codes:
-
[
94040
](
https://simplemaps.com/us-zips/94040
)
(
Mountain
View, CA),
-
[
94304
](
https://simplemaps.com/us-zips/94304
)
(
Palo
Alto, CA),
-
[
94027
](
https://simplemaps.com/us-zips/94027
)
(
Atherton,
CA),
-
[
50860
](
https://simplemaps.com/us-zips/
93636
)
(
Redding,
IA) and
-
[
50860
](
https://simplemaps.com/us-zips/
50860
)
(
Redding,
IA) and
-
[
10023
](
https://simplemaps.com/us-zips/10023
)
(
New
York City, NY Upper West side). (1 Pt)
Results:
```
mean_income in Mountain View, CA is: 1,740,371 - median_income is: 114,820
mean_income in Palo Alto, CA is: 2,077,038 - median_income is: 153,658
mean_income in Atherton, CA is: 2,623,881 - median_income is: 354,087
mean_income in Redding, IA is: 33,333 - median_income is: 31,249
mean_income in New York City, NY U West is: 1,544,990 - median_income is: 104,774
```
(4 Pts)
### 6.) Challenge 6: Explore Python built-in functions
...
...
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