Skip to content

Fix unsupported timedelta unit in Lifestyle #1808

@tamuri

Description

@tamuri

The unit M in timedelta is unsupported in newer versions of Pandas. There is one such usage in Lifestyle. This should be replaced by, e.g., 28 days or 4 weeks or something else.

@mnjowe Do you have any preference?

# get months since last poll
now = self.module.sim.date
months_since_last_poll = round((now - self.date_last_run) / np.timedelta64(1, "M"))
# loop through linear models dictionary and initialise each property in the population dataframe
for _property_name, _model in self._models.items():
if _model['update'] is not None:
df.loc[df.is_alive, _property_name] = _model['update'].predict(
df.loc[df.is_alive], rng=self.rng, other=self.module.sim.date,
months_since_last_poll=months_since_last_poll)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions