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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4