Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DataTools_Tutorial_Demo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
vuppalaa
DataTools_Tutorial_Demo
Commits
dae64383
Commit
dae64383
authored
2 years ago
by
nugentj3
Browse files
Options
Downloads
Patches
Plain Diff
Update censusdata readability per issue#5
parent
0788d5fc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
censusdata_package_tutorial/Censusdata_tutorial.ipynb
+3931
-37
3931 additions, 37 deletions
censusdata_package_tutorial/Censusdata_tutorial.ipynb
censusdata_package_tutorial/Help_Functions.py
+23
-0
23 additions, 0 deletions
censusdata_package_tutorial/Help_Functions.py
with
3954 additions
and
37 deletions
censusdata_package_tutorial/Censusdata_tutorial.ipynb
+
3931
−
37
View file @
dae64383
source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
censusdata_package_tutorial/Help_Functions.py
+
23
−
0
View file @
dae64383
...
...
@@ -27,3 +27,26 @@ def census_cut(tracts, data):
len
(
mask
),
len
(
data
.
index
)
result
=
data
[
mask
]
return
result
def
data_split
(
data
):
data_dict
=
{}
for
row
in
data
.
index
:
split_row
=
re
.
split
(
'
> |,
'
,
str
(
row
))[:
-
1
]
data_dict
[
str
(
row
)]
=
split_row
data_ref
=
pd
.
DataFrame
.
from_dict
(
data_dict
,
orient
=
'
index
'
,
columns
=
[
'
Block Group
'
,
'
Census Tract
'
,
'
County
'
,
'
State: Summary Level
'
,
'
State Code
'
,
'
County Code
'
,
'
Tract
'
])
data_ref
[
'
TOTAL POPULATION
'
]
=
0
data_ref
[
'
Block Group
'
]
=
data_ref
[
'
Block Group
'
].
apply
(
lambda
x
:
int
(
x
.
split
()[
-
1
]))
data_ref
[
'
Census Tract
'
]
=
data_ref
[
'
Census Tract
'
].
apply
(
lambda
x
:
float
(
x
.
split
()[
-
1
]))
data_ref
[
'
State: Summary Level
'
]
=
data_ref
[
'
State: Summary Level
'
].
apply
(
lambda
x
:
[
x
.
split
(
'
:
'
)[
i
]
for
i
in
(
0
,
-
1
)])
data_ref
[
'
State Code
'
]
=
data_ref
[
'
State Code
'
].
apply
(
lambda
x
:
int
(
x
.
split
(
'
:
'
)[
-
1
]))
data_ref
[
'
County Code
'
]
=
data_ref
[
'
County Code
'
].
apply
(
lambda
x
:
int
(
x
.
split
(
'
:
'
)[
-
1
]))
data_ref
[
'
Tract
'
]
=
data_ref
[
'
Tract
'
].
apply
(
lambda
x
:
int
(
x
.
split
(
'
:
'
)[
-
1
]))
return
data_ref
# -
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