Closed
Description
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.