Skip to content

Error dividing Dataframe by Series but only when size is large enough #27853

Closed
@deto

Description

@deto

Code Sample

# This works fine
a = pd.DataFrame(np.random.randn(9999, 10))
b = a.divide(a.sum(axis=0), axis=1)

# This doesn't
a = pd.DataFrame(np.random.randn(10001, 10))
b = a.divide(a.sum(axis=0), axis=1)

# │AttributeError: 'numpy.dtype' object has no attribute 'value_counts'

Problem description

Should be able to divide the dataframe by the series and align on the axis.

This works for smaller dataframes but breaks suddenly for larger ones. Doesn't happen for me on 0.24.0 but occurs on 0.25.0

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.6.8.final.0
python-bits : 64
OS : Linux
OS-release : 4.13.0-45-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 0.25.0
numpy : 1.16.4
pytz : 2019.1
dateutil : 2.8.0
pip : 19.1.1
setuptools : 41.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : 0.4.0
xlsxwriter : 1.1.2
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.6.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.0
numexpr : 2.6.9
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.12.1
pytables : None
s3fs : None
scipy : 1.2.1
sqlalchemy : None
tables : 3.5.2
xarray : None
xlrd : 1.1.0
xlwt : None
xlsxwriter : 1.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions