Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yaroslav
SciBoard
Commits
c92d4eea
Commit
c92d4eea
authored
Nov 11, 2019
by
Мария Григорьева
Browse files
Replace affiliations.py
parent
daef5e79
Changes
1
Hide whitespace changes
Inline
Side-by-side
ES_Helper/affiliations/affiliations.py
View file @
c92d4eea
...
...
@@ -6,7 +6,7 @@ import pprint
es
=
Elasticsearch
([{
'host'
:
'127.0.0.1'
,
'port'
:
9200
}])
INDEX_NAME
=
"russian_affiliations_with_coords"
START_DATE
=
"2019-0
5-01
T00:00:00.000Z"
START_DATE
=
"2019-0
7-20
T00:00:00.000Z"
END_DATE
=
"2019-08-01T00:00:00.000Z"
def
_match_all_date_limit
(
start_date
,
end_date
):
...
...
@@ -121,6 +121,8 @@ def get_matrix(joint):
:return:
"""
unique
=
get_unique
(
joint
)
print
(
unique
)
print
(
len
(
unique
))
column_names
,
row_names
=
unique
,
unique
matrix
=
np
.
zeros
((
len
(
unique
),
len
(
unique
)))
...
...
@@ -153,6 +155,7 @@ def get_connections_df(matrix_df):
df
[
'level_0'
]
=
df
[
'level_0'
].
astype
(
np
.
int64
)
df
[
'level_1'
]
=
df
[
'level_1'
].
astype
(
np
.
int64
)
df
.
rename
(
columns
=
{
0
:
"count"
},
inplace
=
True
)
df
=
df
[
df
[
'count'
]
!=
0.0
]
return
df
...
...
@@ -177,6 +180,7 @@ def main():
query
=
_match_all_date_limit
(
START_DATE
,
END_DATE
)
joint
=
get_joint_affiliations
(
es
,
INDEX_NAME
,
query
)
print
(
joint
)
matrix
=
get_matrix
(
joint
)
update_matrix
(
matrix
,
joint
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment