4.2. cpforager.processing.add_is_night
- cpforager.processing.add_is_night(df, params)
Add to the dataframe an additional
is_nightboolean column worth 1 if it is night, 0 otherwise.- Parameters:
df (pandas.DataFrame) – dataframe with a
datetimecolumn.params (dict) – parameters dictionary.
- Returns:
the dataframe with an additional
is_nightboolean column worth 1 if it is night, 0 otherwise.- Return type:
pandas.DataFrame
The boolean value is computed using suntime and pytz Python package. Night is defined using the sunrise and sunset times at the colony center.
Note
The required fields in the parameters dictionary are
colonyandlocal_tz.Warning
Dataframe
datetimecolumn must be at local time. The accuracy ofis_nightcolumn depends on it.