View pandas dataframe in rstudio ?

Hi,

I want to know if it's possible to view the pandas dataframe in rstudio ?
Something similar to View(df) in R

Thank you

While it's not possible to view the Pandas DataFrame directly, you could convert it to an R data.frame with reticulate and then view that -- would that suffice for your use?

1 Like

Thanks, this is one possible solution but can we view a dataframe without convert it to R data.frame or not yet ?

Sorry, but no, you can not.

1 Like

Kevin is totally correct. But I think you might be misunderstanding how easy conversion is. Take this R Markdown Example:

If we have this chunk with Python code:

```{python}
import pandas as pd
DF = pd.DataFrame({'x' : [1., 2., 3., 4.],
                   'y' : [4., 3., 2., 1.]})

```

We can view (with an implicit convert) by simply doing this:

```{r}
View(py$DF)
```

Which pops up in the IDE very nicely:
image

5 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.