Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fa24
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
JAE HYEON PARK
fa24
Commits
80ca03dd
Commit
80ca03dd
authored
2 months ago
by
JAE HYEON PARK
Browse files
Options
Downloads
Patches
Plain Diff
mp6 completed.
parent
24093392
Branches
master
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
labs-and-projects/mp6/edgar_utils.py
+43
-0
43 additions, 0 deletions
labs-and-projects/mp6/edgar_utils.py
labs-and-projects/mp6/mp6.ipynb
+1645
-0
1645 additions, 0 deletions
labs-and-projects/mp6/mp6.ipynb
with
1688 additions
and
0 deletions
labs-and-projects/mp6/edgar_utils.py
0 → 100644
+
43
−
0
View file @
80ca03dd
import
re
import
netaddr
import
pandas
as
pd
from
bisect
import
bisect
ips
=
pd
.
read_csv
(
"
ip2location.csv
"
)
def
lookup_region
(
ipaddr
):
ipaddr
=
re
.
sub
(
r
'
[a-zA-Z]
'
,
'
0
'
,
ipaddr
)
my_ip
=
int
(
netaddr
.
IPAddress
(
ipaddr
))
idx
=
bisect
(
ips
[
'
low
'
],
my_ip
)
return
ips
.
iloc
[
idx
-
1
][
'
region
'
]
class
Filing
:
def
__init__
(
self
,
html
):
self
.
dates
=
[]
for
item
in
re
.
findall
(
r
"
((19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1]))
"
,
html
):
self
.
dates
.
append
(
item
[
0
])
self
.
sic
=
None
if
re
.
findall
(
r
"
SIC=(\d+)
"
,
html
):
self
.
sic
=
int
(
re
.
findall
(
r
"
SIC=(\d+)
"
,
html
)[
0
])
self
.
addresses
=
[]
for
addr_html
in
re
.
findall
(
r
'
<div class=
"
mailer
"
>([\s\S]+?)</div>
'
,
html
):
lines
=
[]
found
=
re
.
findall
(
r
'
<span class=
"
mailerAddress
"
>([\s\S]+?)</span>
'
,
addr_html
)
if
found
:
for
line
in
found
:
lines
.
append
(
line
.
strip
())
self
.
addresses
.
append
(
"
\n
"
.
join
(
lines
))
def
state
(
self
):
for
address
in
self
.
addresses
:
statecode
=
re
.
findall
(
r
"
\s([A-Z]{2})\s\d{5}
"
,
address
)
if
statecode
:
return
statecode
[
0
]
return
None
def
__repr__
(
self
):
return
f
"
<
{
self
.
sic
}
>
"
This diff is collapsed.
Click to expand it.
labs-and-projects/mp6/mp6.ipynb
0 → 100644
+
1645
−
0
View file @
80ca03dd
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