A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/7025 below:

GroupBy with Float Index not Plotting · Issue #7025 · pandas-dev/pandas · GitHub

Skip to content Navigation Menu

Saved searches Use saved searches to filter your results more quickly

Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Additional navigation options

GroupBy with Float Index not Plotting #7025

Description

I have the following problem: I have a dataset with a float index that I want to group and plot. If I'm using integer indices it works, with floats it doesn't. Here is the minimal example that once works and once not. I'm testing with the current master. Am I doing something wrong?

This code snippet fails:

import pandas as pd
import numpy as np
test = pd.DataFrame({'def': [1,1,1,2,2,2,3,3,3], 'val': np.random.randn(9)}, index=[1.0,2.0,3.0,1.0,2.0,3.0,1.0,2.0,3.0])
test.groupby('def')['val'].plot()

While this works:

# This Works
test = pd.DataFrame({'def': [1,1,1,2,2,2,3,3,3], 'val': np.random.randn(9)}, index= [1,2,3,1,2,3,1,2,3])
test.groupby('def')['val'].plot()

The error I get is:

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-83-e50f1a9b07c6> in <module>()
----> 1 test.groupby('def')['val'].plot()

/Library/Python/2.7/site-packages/pandas-0.13.1_758_g4a67608-py2.7-macosx-10.9-intel.egg/pandas/core/groupby.pyc in __getattr__(self, attr)
    452         if attr in self._internal_names_set:
    453             return object.__getattribute__(self, attr)
--> 454         if attr in self.obj:
    455             return self[attr]
    456 

/Library/Python/2.7/site-packages/pandas-0.13.1_758_g4a67608-py2.7-macosx-10.9-intel.egg/pandas/core/series.pyc in __contains__(self, key)
    379 
    380     def __contains__(self, key):
--> 381         return key in self.index
    382 
    383     # complex

/Library/Python/2.7/site-packages/pandas-0.13.1_758_g4a67608-py2.7-macosx-10.9-intel.egg/pandas/core/index.pyc in __contains__(self, other)
   2042         try:
   2043             # if other is a sequence this throws a ValueError
-> 2044             return np.isnan(other) and self._hasnans
   2045         except ValueError:
   2046             try:

NotImplementedError: Not implemented for this type

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4