Code Monkey home page Code Monkey logo

Comments (6)

jankatins avatar jankatins commented on July 18, 2024

Just as a reference: currently you need to use df.reset_undex() to get the index as a normal column:

by_decade = ts.groupby(floor_decade).sum()
by_decade.index.name = 'year'
by_decade = by_decade.reset_index()

(from http://blog.yhathq.com/posts/aggregating-and-plotting-time-series-in-python.html -> cell 12/13)

from ggpy.

glamp avatar glamp commented on July 18, 2024

I would vote for implementing both of these

  • if no x mapping is given, use the index as x mapping
  • look into the column namess and the index name

Only question would be what happens when there are multiple indices? Just pick the first? Combine them?

from ggpy.

jankatins avatar jankatins commented on July 18, 2024

The "look into both columns and index names" and "index as x if no x is given" should be easy, will do on Tuesday/Wednesday if no one does it before me :-)

re multiindex: I see two ways for using a index when __index__ (or no x variable) is given as mapping: either combine all index into one variable (there should be a way in pandas to combine multiple columns into one... there usually is :-) or simple give an error with the hint how to combine the index into one level or only use one level of the index (by naming it directly or using reset_index). I would vote for the second way, as I suspect the "combine" step will result in strings (datetime + different firms?) and that is usually not helpfull for plotting. And automatically figuring out that this should result in a facet plot or something like this is too much magic for my taste.

from ggpy.

naught101 avatar naught101 commented on July 18, 2024

Has there been any movement on this?

Agree re: multi-indexing. ggplot shouldn't try to be too smart :)

from ggpy.

jankatins avatar jankatins commented on July 18, 2024

Currently this got "harder", as currently we let patsy handle this. One way to fix this would be to first reset the index...

# in ggplot/ggplot.py
def _apply_transforms(data, aes):
[...]
-     data = data.copy()
+     data = data.copy().reset_index()

from ggpy.

jankatins avatar jankatins commented on July 18, 2024

Now in #285, closing here

from ggpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.