Pandas broadcast with numpy scalars #8116

Closed
tritemio opened this Issue Aug 26, 2014 · 0 comments

Comments

Projects
None yet
2 participants

Pandas objects (Series, DataFrame, etc...) can broadcast operations with python scalars. For example:

import pandas as pd
pd.DataFrame([1,2,3])*2

But when performing the same operation with a numpy scalar array:

import pandas as pd
import numpy as np
pd.DataFrame([1,2,3])*np.array(2)

pandas returns an error:

ValueError: Incompatible argument shape: ()

I can't find an explicit mention of scalar broadcasting in Pandas docs but this seems a natural case to be supported.

See also the original SO question.

jreback added this to the 0.15.0 milestone Aug 28, 2014

jreback closed this in #8119 Aug 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment