Skip to content

TypeError: unsupported operand type(s) for +: 'int' and 'Timedelta' #23

@AliothYh

Description

@AliothYh

Traceback (most recent call last):
File "D:\science_tech\Code_git_clone\besttracks\mytest.py", line 7, in
print(TCs_CMA)
File "D:\science_tech\Code_git_clone\besttracks\besttracks\core.py", line 683, in repr
max(yrs), self.total_duration()))
File "D:\science_tech\Code_git_clone\besttracks\besttracks\core.py", line 521, in total_duration
return sum([p.duration() for p in self.particles])
TypeError: unsupported operand type(s) for +: 'int' and 'Timedelta'

def total_duration(self):
"""
Get total duration of this ParticleSet in unit of days.
"""
return sum([p.duration() for p in self.particles])

def duration(self):
"""
Get duration (days) of this particle.

    Returns
    ----------
    re: float
        Duration of this particle in unit of day
    """
    duration = np.ptp(self.records['TIME'])
    return pd.to_timedelta([duration]).astype('timedelta64[h]')[0] / 24.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions