Skip to content

[BUG] Example plot_driver_laptimes.py no longer working with latest Seaborn release #459

@theOehrly

Description

@theOehrly

Describe the issue:

With the release of seaborn v0.13.0 the plot_driver_laptimes.py example has stopped working. Everything works perfectly fine with seaborn v0.12.2 without changing anything else.

This problem is somehow related to Seaborn casting the timedelta64 data type internally, and NumPy is unhappy about that.

Reproduce the code example:

-- see examples/plot_driver_laptimes.py --

Error message:

Traceback (most recent call last):
  File "C:\Dateien\Code\Formula1\Fast-F1\examples\plot_driver_laptimes.py", line 35, in <module>
    sns.scatterplot(data=driver_laps,
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\seaborn\relational.py", line 603, in scatterplot
    p = _ScatterPlotter(
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\seaborn\relational.py", line 390, in __init__
    super().__init__(data=data, variables=variables)
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\seaborn\_base.py", line 634, in __init__
    self.assign_variables(data, variables)
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\seaborn\_base.py", line 685, in assign_variables
    self.var_types = {
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\seaborn\_base.py", line 686, in <dictcomp>
    v: variable_type(
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\seaborn\_base.py", line 1523, in variable_type
    if np.isin(vector, [0, 1]).all():
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\numpy\lib\arraysetops.py", line 890, in isin
    return in1d(element, test_elements, assume_unique=assume_unique,
  File "C:\Dateien\Code\Formula1\Fast-F1\venv39\lib\site-packages\numpy\lib\arraysetops.py", line 733, in in1d
    mask |= (ar1 == a)
numpy.core._exceptions._UFuncInputCastingError: Cannot cast ufunc 'equal' input 0 from dtype('<m8[ns]') to dtype('<m8') with casting rule 'same_kind'

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions