Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# impectPy 2.4.5

# Minor Changes
* fix bug in `getPlayerIterationAverages()`function

# impectPy 2.4.4

# Major Changes
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

A package provided by: Impect GmbH

Version: v2.4.4
Version: v2.4.5

**Updated: June 5th 2025**
**Updated: June 26th 2025**

---

Expand All @@ -30,7 +30,7 @@ You can install the latest version of impectPy from
[GitHub](https://github.com/) with:

``` cmd
pip install git+https://github.com/ImpectAPI/impectPy.git@v2.4.4
pip install git+https://github.com/ImpectAPI/impectPy.git@v2.4.5
```

## Usage
Expand Down
25 changes: 18 additions & 7 deletions impectPy/iteration_averages.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,16 @@ def getPlayerIterationAveragesFromHost(
if len(averages_raw["name"][averages_raw["name"].isnull()]) > 0:
averages_raw["name"] = averages_raw["name"].fillna("-1")

# downcast numerics and category types
averages_raw["iterationId"] = averages_raw["iterationId"].astype("Int16")
averages_raw["squadId"] = averages_raw["squadId"].astype("Int16")
averages_raw["playerId"] = averages_raw["playerId"].astype("Int32")
averages_raw["position"] = averages_raw["position"].astype("category")
averages_raw["name"] = averages_raw["name"].astype("category")
averages_raw["value"] = averages_raw["value"].astype("Float32")
# get KPIs without a scoring
mask = (
averages_raw.iterationId.isnull()
& averages_raw.squadId.isnull()
& averages_raw.playerId.isnull()
& averages_raw.position.isnull()
)

# fill join cols with placeholder
averages_raw.loc[mask] = averages_raw.loc[mask].fillna(-1)

# pivot kpi values
averages_raw = pd.pivot_table(
Expand All @@ -146,6 +149,14 @@ def getPlayerIterationAveragesFromHost(
if "-1" in averages_raw.columns:
averages_raw.drop(["-1"], inplace=True, axis=1)

# drop -1 rows
averages_raw = averages_raw[
~(averages_raw.iterationId == -1)
& ~(averages_raw.squadId == -1)
& ~(averages_raw.playerId == -1)
& ~(averages_raw.position == -1)
]

# merge with playDuration and matchShare
averages_raw = averages_raw.merge(
match_shares_raw,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"pandas>=2.0.0",
"numpy>=1.24.2,<2.0"],
# *strongly* suggested for sharing
version="2.4.4",
version="2.4.5",
# The license can be anything you like
license="MIT",
description="A Python package to facilitate interaction with the Impect customer API",
Expand Down