piper.custom.from_excel

piper.custom.from_excel(excel_date: Union[str, float, int, pandas._libs.tslibs.timestamps.Timestamp])pandas._libs.tslibs.timestamps.Timestamp[source]

apply_date function: excel serial date -> pd.Timestamp

Converts excel serial format to pandas Timestamp object

Examples

assert from_excel(pd.Timestamp('2014-01-01 08:00:00')) == pd.Timestamp('2014-01-01 08:00:00')
assert from_excel('41640.3333') == pd.Timestamp('2014-01-01 08:00:00')
assert from_excel(41640.3333) == pd.Timestamp('2014-01-01 08:00:00')
assert from_excel(44001) == pd.Timestamp('2020-06-19 00:00:00')
assert from_excel('44001') == pd.Timestamp('2020-06-19 00:00:00')
assert from_excel(43141) == pd.Timestamp('2018-02-10 00:00:00')
assert from_excel('43962') == pd.Timestamp('2020-05-11 00:00:00')
assert from_excel('') == ''
assert from_excel(0) == 0
assert pd.isna(from_excel(np.nan)) == pd.isna(np.nan)
assert pd.isna(from_excel(pd.NaT)) == pd.isna(pd.NaT)
Parameters

- serial excel date value (excel_date) –

Returns

Return type

A pandas Timestamp object