Quellcode durchsuchen

changes to avoid future warning from pandas

Ajayrama Kumaraswamy vor 1 Jahr
Ursprung
Commit
61f1ee0ddc

+ 3 - 0
tests/export_movie_test.py

@@ -127,6 +127,7 @@ def test_different_export_formats():
     export_fake_data_movie({"mv_exportFormat": "single_tif", 'mv_individualScale': 2}, "_indScale2")
     export_fake_data_movie({"mv_exportFormat": "ayuv", 'mv_individualScale': 2}, "_indScale2_ayuv")
 
+
 def test_filters():
     """
     Testing export movie with temporal and spatial filters
@@ -203,6 +204,7 @@ def test_thresholdShowImage():
                                     f"mv_thresholdOn_foto1_posVal_a1000_Image_"
                                     f"{threshold_show_image}_scale_{threshold_scale}")
 
+
 def test_withinArea():
     """
     Testing export movie with mv_withinArea set
@@ -260,6 +262,7 @@ def test_mark_rois():
         flags2use_new["mv_cutborder"] = 5
         export_fake_data_movie(flags_to_update=flags2use_new, movie_name_suffix=f"mv_showROIs{test_value}_cutborder5")
 
+
 @raises(ValueError)
 def test_large_bordercut():
     """

+ 1 - 1
tests/generate_overviews_tests.py

@@ -109,6 +109,7 @@ def test_scale_flags():
             flags["SO_indiScale3factor"] = 0
             generate_overviews(flags, f"SO_individualScale{indiscale}_factor0{label}")
 
+
 @raises(ValueError)
 def test_large_bordercut():
     """
@@ -118,7 +119,6 @@ def test_large_bordercut():
     generate_overviews({"SO_cutborder": 106}, "_impossible")
 
 
-
 def test_filters():
     """
     Testing generating overviews with spatial filters

+ 1 - 1
view/python_core/measurement_list/__init__.py

@@ -208,7 +208,7 @@ class MeasurementList(object):
 
             if col_name not in self.measurement_list_df.columns:
 
-                self.measurement_list_df[col_name] = default_value
+                self.measurement_list_df.loc[:, col_name] = default_value
 
     def convert_to_numeric(self):
         self.measurement_list_df = \

+ 6 - 37
view/python_core/measurement_list/io.py

@@ -85,44 +85,13 @@ def get_format_specific_defs():
     :return:
     """
 
-    df = pd.DataFrame(columns=("IOclass", "relevant_column", "extension"))
-
     # the order of definition here is very important. It sets the hierarchy when looking for list files.
-    tempS = pd.Series()
-    tempS.name = "XLS LST format"
-    tempS["IOclass"] = XLSIO
-    tempS["relevant_column"] = "LST Name"
-    tempS["extension"] = ".lst.xls"
-
-    df = df.append(tempS)
-
-    tempS_copy = tempS.copy()
-    tempS_copy.name = "XLSX LST format"
-    tempS_copy["extension"] = ".lst.xlsx"
-
-    df = df.append(tempS_copy)
-
-    tempS = pd.Series()
-    tempS.name = "Legacy Text LST format"
-    tempS["IOclass"] = LSTIO
-    tempS["relevant_column"] = "LST Name"
-    tempS["extension"] = ".lst"
-
-    df = df.append(tempS)
-
-    tempS = pd.Series()
-    tempS.name = "XLS FID Settings format"
-    tempS["IOclass"] = XLSIO
-    tempS["relevant_column"] = "Settings Name"
-    tempS["extension"] = ".settings.xls"
-
-    df = df.append(tempS)
-
-    tempS_copy = tempS.copy()
-    tempS_copy.name = "XLSX FID Settings format"
-    tempS_copy["extension"] = ".settings.xlsx"
-
-    df = df.append(tempS_copy)
+    df = pd.DataFrame(columns=["IOclass", "relevant_column", "extension"])
+    df.loc["XLS LST format", :] = [XLSIO, "LST Name", ".lst.xls"]
+    df.loc["XLSX LST format", :] = [XLSIO, "LST Name", ".lst.xlsx"]
+    df.loc["Legacy Text LST format"] = [LSTIO, "LST Name", ".lst"]
+    df.loc["XLS FID Settings format"] = [XLSIO, "Settings Name", ".settings.xls"]
+    df.loc["XLSX FID Settings format"] = [XLSIO, "Settings Name", ".settings.xlsx"]
 
     return df
 

+ 1 - 1
view/python_core/stimuli/__init__.py

@@ -92,7 +92,7 @@ class BaseStimuliiHandler(object):
                                  data_sampling_period_td]],
                                columns=self.stimulus_frame.columns)
 
-        self.stimulus_frame = self.stimulus_frame.append(temp_df, ignore_index=True)
+        self.stimulus_frame = pd.concat([self.stimulus_frame, temp_df], ignore_index=True)
 
         return 0