In a jupiter notebook I created some 2-d-list in R like
%%R
first <- "first"
second <- "second"
names(first) <- "first_thing"
names(second) <- "second_thing"
x <- list()
index <- length(x)+1
x[[index]] = first
x[[index +1]] = second
a %Rpull x does not return the nice representation but rather a ListVector. How can I convert it into something nicer e.g. a dict / pd.Dataframe? So far I had no luck following http://pandas.pydata.org/pandas-docs/stable/r_interface.html

The list I want to convert is a 2-d list like results the updated code snipped from above
Just slice the ListVector:
%Rpull x
pd.DataFrame(data=[i[0] for i in x], columns=['X'])

If you want a dictionary instead:
dict([[i,j[0]] for i,j in enumerate(x)])
{0: 'first', 1: 'first'}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With