Skip to content

BUG: max()/min() don't work on DataFrames constructed from scipy sparse matrix #40921

Closed
@melkonyan

Description

@melkonyan

Example:

import pandas as pd
from scipy import sparse as sc
import numpy as np

np.random.seed(42)
a = np.random.randint(0, 10, size=(200, 5))
a_sp = sc.coo_matrix(a)
a_sp_pd = pd.DataFrame.sparse.from_spmatrix(a_sp)
a_sp_pd.max()

Expected output:

0    9
1    9
2    9
3    9
4    9
dtype: int64

Actual output:

Series([], dtype: float64)

System info:

  - numpy [required: >=1.17, installed: 1.20.2]
  - scipy [required: >=0.19.1, installed: 1.6.2]
  - pandas [required: >=1.0.0,<=1.1.4, installed: 1.2.4]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions