On 2013-02-11 16:06, Luca Beltrame wrote:
In data domenica 10 febbraio 2013 12:20:22, Thomas Kluyver ha scritto:
While we're on the subject, by the way, I have a pull request open on
IPython to improve how we handle a simple pandas DataFrame being passed
into rmagic. I imagine this is quite a common case, and at present rmagic
Just a bit of background, since I wrote the original pandas-to-data.frame
conversion that's used by pandas at the moment.

The code originated by an internal app I wrote, which shuffled data back and
forth between R and Python. At the moment, numpy2ri() wasn't quite giving the
results I expected, and my (feeble!) attempts at trying to do that in rpy2
failed (granted, I could have probably asked for more help here), so I built
something "static" like the one used in pandas.

Documentation can be lacking (in quantity or in clarity), but do ask.
Rpy2 is designed to be tweaked and modified to make possibly any
interface to R you'd like. While I can be hard to move on some of the
design choices with it, I make sure than any alternative interface or
customization can be implemented at the Python level.


Looking at what Laurent made in rpy2, I think that way is much better than the
one I wrote. Laurent, if you make a release containing that converter soon,
I'll make a PR to pandas to use that code path. This will mean of course that
newer pandas will have to require that specific version of rpy2.

The current release of rpy2 (2.3.x) only supports Python 2.7 and Python 3.3.
If pandas is supporting other Python versions, you may consider this to be a problem.

On the other hand, the converter I have added should be compatible with the 2.2.x series of rpy2 (the conversion system has been in rpy2 there since the very beginning)... since this is a module file, one options would be to just copy it. Code duplication is not the best thing but this could help until support for Python 2.6 is dropped. Just remember to monitor changes or bugfix in rpy2 (and conversely report bug fixing back).

If curious about conversion with rpy2 in general, there is a brief documentation for it:
http://rpy.sourceforge.net/rpy2/doc-2.3/html/robjects_convert.html?#mapping-rpy2-objects-to-arbitrary-python-objects





------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb


_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to