Skip to content

Error when subtracting mixed type DataFrame #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aman-thakral opened this issue Mar 13, 2012 · 3 comments
Closed

Error when subtracting mixed type DataFrame #910

aman-thakral opened this issue Mar 13, 2012 · 3 comments
Labels
Milestone

Comments

@aman-thakral
Copy link
Contributor

Sample code to reproduce the error:

import numpy as np
import pandas

X = np.random.rand(10,10)
Y = np.ones((10,1),dtype=int)
df1 = pandas.DataFrame(X)
df1 = df1.join(pandas.DataFrame(Y),lsuffix='.X')

print df1-df1.mean()


Traceback (most recent call last):
File "pls_model.py", line 383, in
run(df)
File "pls_model.py", line 305, in run
report(df.copy(),n_comp,priors=priors,plot=False)
File "pls_model.py", line 83, in report
plsgnb.fit(X,Y,priors=priors)
File "C:\src\multivariate\src\multivariate\PLS.py", line 477, in fit
self.model.fit(X,Y)
File "C:\src\multivariate\src\multivariate\PLS.py", line 145, in fit
print x - self.Xmean
File "C:\src\pandas\pandas\core\frame.py", line 177, in f
return self._combine_series(other, func, fill_value, axis, level)
File "C:\src\pandas\pandas\core\frame.py", line 2526, in _combine_series
return self._combine_series_infer(other, func, fill_value)
File "C:\src\pandas\pandas\core\frame.py", line 2541, in _combine_series_infer
return self._combine_match_columns(other, func, fill_value)
File "C:\src\pandas\pandas\core\frame.py", line 2552, in _combine_match_columns
left, right = self.align(other, join='outer', axis=1, copy=False)
File "C:\src\pandas\pandas\core\frame.py", line 1735, in align
method=method)
File "C:\src\pandas\pandas\core\frame.py", line 1804, in _align_series
return (left_result.fillna(fill_value, method=method),
File "C:\src\pandas\pandas\core\frame.py", line 2426, in fillna
new_data = self._data.fillna(value)
File "C:\src\pandas\pandas\core\internals.py", line 938, in fillna
new_blocks = [b.fillna(value) for b in self.blocks]
File "C:\src\pandas\pandas\core\internals.py", line 211, in fillna
new_values.flat[mask] = value
ValueError: cannot convert float NaN to integer

@aman-thakral
Copy link
Contributor Author

I just checked this against 0.7.0 and the problem is not present. This is related to 0.7.1. Would this problem also be a good candidate to include in the tests?

@adamklein
Copy link
Contributor

Absolutely, needs to get in the test suite and fixed! Good catch

@wesm wesm closed this as completed in f982225 Mar 15, 2012
@wesm
Copy link
Member

wesm commented Mar 15, 2012

hi @aman-thakral fixed a pair of related issue around this. thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants