Skip to content

merge or join fails if the left input dataframe contains a column of float32 #1849

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
aheilbut opened this issue Sep 6, 2012 · 1 comment
Labels
Milestone

Comments

@aheilbut
Copy link

aheilbut commented Sep 6, 2012

A merge or join involving a left DataFrame that has single precision floats will fail. Seems to be OK if the right dataframe has float32; these get cast to float64 (which they probably shouldn't be)

import numpy as np
import pandas
a = np.random.randint(0, 5, 100)
df = pandas.DataFrame({'a': a})
s = pandas.DataFrame( pandas.Series(np.random.random(5).astype('f'), name='md') )
df.merge(s, left_on='a', right_index=True) # this is OK
df['b'] = np.random.randint(0, 5, 100)
df.merge(s, left_on='a', right_index=True) # this is OK
df['c'] = np.random.random(100).astype('Float64')
df.merge(s, left_on='a', right_index=True) # this is OK
df['d'] = np.random.random(100).astype('Float32')
print df.dtypes
df.merge(s, left_on='a', right_index=True) # this fails
@wesm
Copy link
Member

wesm commented Sep 10, 2012

fixed in #1882. 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