Skip to content

Commit 5be1831

Browse files
committed
feat: add check for empty dataframes in getFeatureCorrelations
1 parent 173b212 commit 5be1831

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/readii/analyze/correlation.py

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def getFeatureCorrelations(vertical_features:pd.DataFrame,
3838
msg = "horizontal_features must be a pandas DataFrame"
3939
logger.exception(msg)
4040
raise TypeError()
41+
42+
# Check for empty DataFrames
43+
if vertical_features.empty or horizontal_features.empty:
44+
msg = "Cannot calculate correlations with empty DataFrames"
45+
logger.exception(msg)
46+
raise ValueError(msg)
4147

4248
if method not in ["pearson", "spearman", "kendall"]:
4349
msg = "Correlation method must be one of 'pearson', 'spearman', or 'kendall'."

0 commit comments

Comments
 (0)