Simplify byte column selection in correlation calculation

This commit is contained in:
2026-07-22 19:46:32 +02:00
parent 0a4dc5801e
commit 9965bc761f
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -27,8 +27,7 @@ def _ensure_int_bytes(df: pd.DataFrame, cols: list) -> pd.DataFrame:
return df
def calculate_correlation(df: pd.DataFrame, method: str, target_id: str | None = None) -> pd.DataFrame:
byte_cols = [f"b{i}" for i in range(8) if f"b{i}" in df.columns]
available_cols = [col for col in byte_cols if col in df.columns]
available_cols = [f"b{i}" for i in range(8) if f"b{i}" in df.columns]
if not available_cols:
raise ValueError("No byte columns (b0-b7) found in the DataFrame")
+1 -2
View File
@@ -36,8 +36,7 @@ def _entropy_col(a: np.ndarray) -> float:
return float(-np.sum(p * np.log2(p)))
def calculate_byte_entropy(df: pd.DataFrame) -> pd.DataFrame:
byte_cols = [f"b{i}" for i in range(8) if f"b{i}" in df.columns]
available_cols = byte_cols
available_cols = [f"b{i}" for i in range(8) if f"b{i}" in df.columns]
if not available_cols:
raise ValueError("No byte columns (b0-b7) found in the DataFrame")