-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Adding column of floats to DataFrame yields TypeError #7366
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
Comments
what version of pandas? can u pickle the data (table and what u r adding) and give a link? |
@fonnesbeck are your columns float columns? Can you the output of df.columns? |
Sorry. Updated info above. |
Yes, the table columns are floats:
|
that's a pretty old version what changed in your setup? did u try 0.14.0? |
i think i know what's going on ... i'm guilty of that |
I'm just updating now from master. Thanks for the prompt response, as usual. |
you have float columns (the index) |
yep ... can repro with this: In [6]: df = DataFrame({0.0: rand(10), 1.0: rand(10)})
In [7]: df['a'] = 10 i think this should work since it works with int |
fix on the way |
needs to coerce back to Index I think |
no just need to catch the |
thanks @fonnesbeck sorry for breaking your code |
No sweat. You guys are awesome. |
Hey, I stumbled on that bug (I think the pip version suffers it). I don't really need a float index, and -even though I'll update pandas later- I would like to recast my faulty Is there a good way to do that (appart from the obvious stripping off the float index, casting it to int, and indexing back)? Thanks, G. |
well you can |
Yes, but I wanted to keep the original MultIndex, only casted from float to int, not drop it alltogether |
Cast it to int (this will truncate FYI)
|
Ok that's what I did, |
I have a function that builds a DataFrame of summary statistics that I have used routinely for several months, but now breaks due to a change in Pandas over the past few weeks. Specifically, I have the following list of floats:
Which I use to create a column in the following table:
However, this now causes the following:
Here is a more verbose output:
Not exactly sure which change caused it, but this code was working on the same data 3-4 weeks ago.
Currently running 0.13.1-936-g592a537 on OS X 10.9.3, Python 2.7.6 from Homebrew.
The text was updated successfully, but these errors were encountered: