-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.md
More file actions
216 lines (180 loc) · 6.45 KB
/
Copy pathREADME.md
File metadata and controls
216 lines (180 loc) · 6.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<p align="right">
<a href="https://github.com/artemkush1/hltv_parser/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/artemkush1/hltv_parser"></a>
<a href="https://github.com/artemkush1/hltv_parser/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/artemkush1/hltv_parser"></a>
</p>
## INSTALLATION
```
$ pip3 install -r requirements.txt
```
OR
```
$ pip3 install requests urllib3 datetime bs4 numpy pandas
```
## USAGE
```
from hltv import [class or function name]
```
### Parse matches
```
>>> get_results_url(filename=None, pages_with_results=[0])
```
> ___type: func___ <br />
> Params:
> - *filename* - for saving pandas frame <br />
> - *pages_with_results* - array with numbers of pages with results <br />
>
> Return pandas DataFrame with columns:
> - match_url <br />
---
### Add main common info from match page
```
>>> MatchPageParams(df, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame with match urls
> - *start_index* - start index
> - *finish_index* - last index
```
>>> MatchPageParams.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns:
> - *match_url* - link to the match
> - *event_url* - link to the tournament
> - *players_url_1* - links to players of the 1st team
> - *players_url_2* - links to players of the second team
> - *maps_url* - links to statistics of played maps
> - *maps_name* - map names
> - *score1_maps* - score on each map of team 1
> - *score2_maps* - score on each map of team 2
> - *picks* - peaks of teams; 1 - the first team, -1 - the second team; if the array is None, then the maps are < 2
> - *date* - match date
> - *total_maps* - in total it was planned to play cards (usually 1, 3 or 5)
> - *maps_played* - how many cards were played as a result
> - *score1* - score of the 1st team
> - *score2* - score of the 2nd team
> - *h2h_wins1* - history of victories of the 1st team over the 2nd
> - *h2h_wins2* - the history of victories of the 2nd team over the 1st
> - *rank1* - rank of the 1st team
> - *rank2* - rank of the 2nd team
> - *5last_match[match_id]_total_maps[team_id]* - the last 5 matches of the [team_id] (1 or 2); [match_id] - serial number of the match; total maps played
> - *5last_match[match_id]_score[team_id]* - the last 5 matches of the [team_id] (1 or 2); [match_id] - serial number of the match; score [team_id] in this match
> - *5last_match[match_id]_opponent_score[team_id]* - the last 5 matches of the [team_id] (1 or 2); [match_id] - serial number of the match; opponent score in this match
---
### Add last played maps each team
```
>>> LastMaps(df, last_maps=20, months=3, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame from previous step
> - *last_maps* - last X played maps
> - *months* - time period
> - *start_index* - start index
> - *finish_index* - last index
```
>>> LastMaps.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns:
> - *last_maps [id] _score [team_id]* - team*s score; id - map number, team_id - team number (team1 or team2)
> - *last_maps [id] _opponent_score [team_id]* - opponent’s score; id - map number, team_id - team number (team1 or team2)
---
### Add info about tournament
```
>>> Tour(df, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame from previous step
> - *start_index* - start index
> - *finish_index* - last index
```
>>> Tour.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns:
> - *event_type* - type of tournament (Lan or Online)
> - *event_teams* - the number of teams in the tournament
> - *prize_pool* - prize pool of the tournament
---
### Add played time in teams each player
```
>>> PlStatInTeam(df, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame from previous step
> - *start_index* - start index
> - *finish_index* - last index
```
>>> PlStatInTeam.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns: <br />
> playerID - player number (from 1 to 5); team_id - team number (1 or 2)
> - *player [playerID]_days_in_current_team[team_id]* - days how long player is in the team (0 or more)
> - *player[playerID]_days_in_all_team[team_id]* - days how long player is in all teams (0 or more)
> - *player[playerID]_teams_all_team[team_id]* - the number of teams the player was in (0 or more)
---
### Add all stats each player
```
>>> PlStatAll(df, months=3, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame from previous step
> - *months* - time period
> - *start_index* - start index
> - *finish_index* - last index
```
>>> LastMaps.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns: <br />
> - *[param] _player [player] _team [team_id]* - player statistics
> - *[param] _maps_player [player_id] _team {team_id}* - played maps for calculating statistics (only some parameters)
> - *age_player [player_id] _team [team_id]* - player age
---
### Add stats on all maps each team
```
>>> AllMapsStat(df, last_maps=20, months=3, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame from previous step
> - *last_maps* - last X played maps on map
> - *months* - time period
> - *start_index* - start index
> - *finish_index* - last index
```
>>> LastMaps.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns: <br />
> - *[param][map]_team[team_id]*
> - *map_played[id]_team[team_id]* - score; [id] - serial number of played map
> - *map_played[id]_opponent_team[team_id]* - opponent score; [id] - serial number of played map
---
### Split DataFrame on maps and save stats on played map each team
```
>>> MapsStatTeamFull(df, last_maps=20, months=3, start_index=None, finish_index=None)
```
> ___type: class___ <br />
> Params:
> - *df* - pandas frame from previous step
> - *last_maps* - last X played maps on map
> - *months* - time period
> - *start_index* - start index
> - *finish_index* - last index
```
>>> MapsStatTeamFull.add_all_params()
```
> ___type: func___ <br />
> Modify pandas frame, add columns: <br />
> - *[param]_team[team_id]*
> - *current_map_played_[id]_team[team_id]* - score; [id] - serial number of played map
> - *current_map_played_[id]_opponent_team[team_id]* - opponent score; [id] - serial number of played map
>
> Return new pandas DataFrame with all columns