MCPcopy Create free account
hub / github.com/datapane/datapane / timedelta_to_str

Function timedelta_to_str

python-client/src/datapane/common/df_processor.py:60–66  ·  view source on GitHub ↗

convert timedelta to str NOTE - only until arrow.js supports Duration type

(df: pd.DataFrame)

Source from the content-addressed store, hash-verified

58
59
60def timedelta_to_str(df: pd.DataFrame):
61 """
62 convert timedelta to str
63 NOTE - only until arrow.js supports Duration type
64 """
65 df_td = df.select_dtypes("timedelta")
66 df[df_td.columns] = np.where(pd.isnull(df_td), pd.NA, df_td.astype("string"))
67
68
69def parse_categories(data: pd.DataFrame):

Callers 2

test_timedelta_to_strFunction · 0.90
process_dfFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_timedelta_to_strFunction · 0.72