fix: A value is trying to be set on a copy of a slice from a DataFrame #5582 (#5591)

This commit is contained in:
Abhishek Amar
2023-10-24 00:04:12 +05:30
committed by GitHub
parent 90eeabf82c
commit 5d9d71ec85

View File

@@ -647,7 +647,7 @@ def clean_metrics_df(data: pd.DataFrame, num: int, mask: bool = False) -> pd.Dat
"""
# iloc will fail if number is greater than number of columns
num = min(num, data.shape[1])
data = data.iloc[:, 0:num]
data = data.iloc[:, 0:num].copy()
if mask:
data = data.mask(data.astype(object).eq(num * ["None"])).dropna()