From 812a8dfe96b407b6c4f44d58a9089887d2f89685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 7 Mar 2025 17:09:29 -0800 Subject: [PATCH] Fix dtype that got lost when calling to_pandas(); from object to float --- light_curves/code_src/gaia_functions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/light_curves/code_src/gaia_functions.py b/light_curves/code_src/gaia_functions.py index 4adfab32..464334c6 100644 --- a/light_curves/code_src/gaia_functions.py +++ b/light_curves/code_src/gaia_functions.py @@ -245,7 +245,12 @@ def gaia_clean_dataframe(gaia_df): # and only keep those columns that we need for the MultiIndexDFObject gaia_df = gaia_df[colmap.keys()].rename(columns=colmap) + # We need to flatted out the multidim columns. Also note, the dtype of these columns + # are not properly propagated when ``to_pandas()`` was called, we deal with this issue now. + gaia_df = gaia_df.explode(['flux', 'err', 'time']) + gaia_df = gaia_df.astype({'flux': float, 'err': float}) + # return the light curves as a MultiIndexDFObject indexes, columns = ["objectid", "label", "band", "time"], ["flux", "err"] df_lc = MultiIndexDFObject(data=gaia_df.set_index(indexes)[columns])