Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
BUG: Series.float divided by Series.interger (with 0's) #7785
Comments
|
hmm, this does look like its doing the wrong thing. care to do a pull-request to fix ? |
jreback
added Bug Numeric
labels
Jul 18, 2014
jreback
added this to the
0.15.0
milestone
Jul 18, 2014
xdliao
commented
Jul 18, 2014
|
I am new to development and probably will take too long |
jreback
changed the title from
pandas Series division bug to BUG: Series.float divided by Series.interger (with 0's)
Jul 18, 2014
jreback
referenced
this issue
Jul 18, 2014
Merged
BUG: Bug in Series 0-division with a float and integer operand dtypes (GH7785) #7786
|
fixed in #7786. Bug in that thanks for the report |
jreback
closed this
in #7786
Jul 18, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
xdliao commentedJul 18, 2014
problem when denominator is interger type and has 0 element
no such problem with pandas <= 0.13.1
print pd.version
print np.version
testdata=pd.DataFrame({'TL': (1,0), 'PI': (-0.01,-0.02)})
print "--- direct pd.Series division (wrong) : \n", (testdata.PI)/testdata.TL
print "--- np.where filtered (still wrong!!): ",np.where(testdata.TL>0.001,testdata.PI/testdata.TL,0 )
print "--- direct pd.Series division (OK for float type) : \n", testdata.PI/(testdata.TL.astype(float))
print "--- values division (correct)", testdata.PI.values/testdata.TL.values
-------------- Output ---------
0.14.0
1.7.1
--- direct pd.Series division (wrong) :
0 -inf
1 -inf
dtype: float64
--- np.where filtered (still wrong!!): [-inf 0.]
--- direct pd.Series division (OK for float type) :
0 -0.010000
1 -inf
dtype: float64
--- values division (correct) [-0.01 -inf]