Forráskód Böngészése

change correlation matrix calculation back to previous version

ogert 4 éve
szülő
commit
15925a9b35
1 módosított fájl, 3 hozzáadás és 3 törlés
  1. 3 3
      cdplib/DataExplorer/DataExplorer.py

+ 3 - 3
cdplib/DataExplorer/DataExplorer.py

@@ -63,10 +63,10 @@ class DataExplorer:
     def calculate_big_matrix_correlation(self, data: pd.DataFrame, column_name_to_predict: str, method: str='pearson') -> pd.DataFrame():
 
         num_columns = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64', 'bool']
-        numeric_data = data.select_dtypes(num_columns)
         result_data = {}
-        for column in numeric_data.columns:
-            result_data[column] = numeric_data[column_name_to_predict].corr(numeric_data[column], method=method)
+        for column in data.columns:
+            if data[column].dtype in num_columns: 
+                result_data[column] = data[column_name_to_predict].corr(data[column], method=method)
         
         result_df = pd.DataFrame.from_dict(result_data, orient='index')
         label_string = method + ' correlation'