Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2014104109
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
송성호
2020-10-20 10:40:50 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
98fe0c1596abcc69b6a24387b462239a80d02a0d
98fe0c15
1 parent
d6013dfa
baseball.xlsx
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
소스코드/baseball.py
소스코드/baseball.xlsx
소스코드/baseball.py
0 → 100644
View file @
98fe0c1
#-*-encoding utf-8 -*-
import
matplotlib.pyplot
as
plt
import
networkx
as
nx
from
openpyxl
import
load_workbook
wb
=
load_workbook
(
"baseball.xlsx"
)
load_ws
=
wb
[
'Sheet1'
]
def
make_edge
(
BBlist
):
edge_list
=
[]
for
i
in
range
(
0
,
len
(
BBlist
)):
for
j
in
range
(
0
,
len
(
BBlist
)):
if
i
==
j
:
break
else
:
edge_list
.
append
((
BBlist
[
i
],
BBlist
[
j
]))
return
edge_list
BB_school_list
=
[]
BB_player_list
=
[]
for
i
in
range
(
1
,
857
,
1
):
school_name
=
'G'
+
str
(
i
)
player_name
=
'B'
+
str
(
i
)
name3
=
(
str
(
load_ws
[
school_name
]
.
value
)
+
','
+
str
(
load_ws
[
player_name
]
.
value
))
.
split
(
','
)
BB_player_list
.
append
(
int
(
load_ws
[
'H'
+
str
(
i
)]
.
value
))
BB_school_list
.
append
(
name3
)
edge_list
=
[]
graph_list
=
[]
check_list
=
[]
for
i
in
range
(
0
,
856
):
graph
=
nx
.
Graph
()
edge
=
make_edge
(
BB_school_list
[
i
])
if
BB_school_list
[
i
]
in
check_list
:
BB_player_list
[
i
]
=
BB_player_list
[
i
]
+
BB_player_list
[
check_list
.
index
(
BB_school_list
[
i
])]
BB_player_list
[
check_list
.
index
(
BB_school_list
[
i
])]
=
BB_player_list
[
i
]
check_list
.
append
(
BB_school_list
[
i
])
else
:
check_list
.
append
(
BB_school_list
[
i
])
edge_list
.
append
(
edge
)
graph
.
add_nodes_from
(
BB_school_list
[
i
])
graph
.
add_edges_from
(
edge_list
[
i
],
weight
=
round
(
BB_player_list
[
i
]
/
100000000
,
5
))
graph_list
.
append
(
graph
)
total
=
nx
.
Graph
()
for
i
in
range
(
0
,
856
):
total
=
nx
.
compose
(
total
,
graph_list
[
i
])
degree
=
total
.
degree
()
nx
.
write_gexf
(
total
,
"baseball.gexf"
)
options
=
{
'edge_color'
:
'#FFDEA2'
,
'width'
:
1
,
'with_labels'
:
True
,
'font_weight'
:
'regular'
,
}
plt
.
figure
(
figsize
=
(
20
,
20
))
pos
=
nx
.
spring_layout
(
total
,
iterations
=
10
)
nx
.
draw
(
total
,
pos
,
**
options
,
font_family
=
'batang'
,
font_color
=
'black'
,
font_size
=
8
)
ax
=
plt
.
gca
()
ax
.
collections
[
0
]
.
set_edgecolor
(
"#555555"
)
plt
.
show
()
소스코드/baseball.xlsx
0 → 100644
View file @
98fe0c1
No preview for this file type
Please
register
or
login
to post a comment