Hi John,

On 12/05/10 07:22, John Owens wrote:
> I'm having some trouble figuring out how to change a column in a DataFrame.
> I can extract the column labeled X with:
>
> df.rx2('X')

please use self-contained examples. It makes it easier to ascertain what 
you are doing / try to achieve.

> which seems to give me an R vector, which is good. But I can't figure out how 
> to
> iterate through that vector and manipulate it in python:
>
> print [function(x) for x in df.rx2('X')]  # error

Without the exact error occurring, and without a self-contained example, 
it is hard to comment (as this should work).

> for k,v in df.rx2('X').iteritems():       # also an error
>
> and I also don't know how to replace that (python) vector back into the
> DataFrame (I can use cbind to make a new column, but I'd rather replace the 
> old
> column with the new one).
>
> This would be a good example for the DataFrame section of the docs, I think. 
> Any
> help appreciated!

Yes. The documentation should/will grow in time (and contributions are 
welcome btw).



Laurent


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


------------------------------------------------------------------------------

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

Reply via email to