Code Monkey home page Code Monkey logo

Comments (5)

MSeal avatar MSeal commented on June 19, 2024 2

Yes today you have to convert to/from json which has lots of problems.

This PR: #37 adds pandas and arrow dataframe support, but I had put it on hold for other work. I've wrapped up those other tasks so this is like the next PR / feature I will be working on in the near future to get released.

from scrapbook.

MSeal avatar MSeal commented on June 19, 2024 1

This functionality was merged to master last week, just not released yet -- it uses pyarrow to encode the dataframe in master which is a little better than the to_dict and from_dict.

from scrapbook.

jerrylam avatar jerrylam commented on June 19, 2024

If you look at this file: https://github.com/nteract/scrapbook/blob/master/scrapbook/encoders.py
arrow is commented out for some reasons.

from scrapbook.

choldgraf avatar choldgraf commented on June 19, 2024

Just a quick note here - couldn't this be relatively quickly solved by using an encoder such as this:

class DataFrameEncoder(object):
    def encode(self, scrap):
        # scrap.data is any type, usually specific to the encoder name
        scrap = scrap._replace(data=scrap.data.to_dict())
        return scrap

    def decode(self, scrap):
        # scrap.data is one of [None, list, dict, *six.integer_types, *six.string_types]
        scrap = scrap._replace(data=pd.DataFrame.from_dict(scrap.data))
        return scrap

encoder_registry.register('pandas', DataFrameEncoder())

This allows me to do sb.glue('mydf', 'df', 'pandas')

Maybe not very edge-casey and elegant, but could be a start?

from scrapbook.

MSeal avatar MSeal commented on June 19, 2024

In this PR #62 (closing as the issue should be resolved)

from scrapbook.

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.