Skip to content
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

BUG: hist raises TypeError when df contains non numeric column #7277

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented May 29, 2014

DataFrame.hist without by keyword raises TypeError when it contains non-numeric column.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pandas.util.testing as tm

n=100
gender = tm.choice(['Male', 'Female'], size=n)
classroom = tm.choice(['A', 'B', 'C'], size=n)
single = tm.choice(['S'], size=n)

df = pd.DataFrame({'gender': gender,
                   'classroom': classroom,
                   'height': np.random.normal(66, 4, size=n),
                   'weight': np.random.normal(161, 32, size=n),
                   'category': np.random.randint(4, size=n)})

df.hist(by='gender')
# This works, even though 'classroom' (str) column in still contained

df.hist()
# TypeError: cannot concatenate 'str' and 'float' objects

@jreback jreback added this to the 0.14.1 milestone May 29, 2014
@jreback jreback added the Bug label May 29, 2014
@jreback
Copy link
Contributor

jreback commented May 30, 2014

@TomAugspurger ok by you?

@TomAugspurger
Copy link
Contributor

Merged via fa0f78f

Thanks.

@sinhrks sinhrks deleted the histnum branch May 30, 2014 19:28
@jreback
Copy link
Contributor

jreback commented May 30, 2014

@TomAugspurger I just uploaded mac osx wheels to PyPi. Can you try to install and see if it works?

@TomAugspurger
Copy link
Contributor

Tested on 2.7 and 3.3. Both of those worked.

@jreback
Copy link
Contributor

jreback commented May 30, 2014

excellent!

@TomAugspurger
Copy link
Contributor

This build failed on Travis, but the failure seems to be unrelated. I restarted the build.

@sinhrks
Copy link
Member Author

sinhrks commented May 31, 2014

@TomAugspurger @jreback Thanks to merge. The failure seems to be caused by unrelated part. I've created a issue #7289.

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

Successfully merging this pull request may close these issues.

None yet

3 participants