title: How to Convert Pandas DataFrames to R Dataframes using Reticulate in Rmarkdown
body: <p>I use Rmarkdown with the reticulate package to weave python and R together. However, the process of converting Pandas DataFrames to R Dataframes doesn't appear to work consistently.</p>
  <p>Here is a reproducible example:</p>
  <pre><code>---
  output: html_document
  ---
  
  ```{r setup, include=FALSE}
  knitr::opts_chunk$set(echo = TRUE)
  ```
  
  ```{python}
  import pandas as pd
  df = pd.DataFrame({'a':4, 'b':5, 'c':9}, index=[0])
  print(df)
  ```
  
  ```{r}
  library(reticulate)
  df2 &lt;- reticulate::py$df
  print(df2)
  print(reticulate::py$df)
  ```
  </code></pre>
  <p>Expected Result:<br />
  I expect a crude rendering of the dataframe (3-times) as follows:</p>
  <pre><code>##    a  b  c
  ## 0  4  5  9
  
  ##    a  b  c
  ## 0  4  5  9
  
  ##    a  b  c
  ## 0  4  5  9
  </code></pre>
  <p>Actual Result:</p>
  <pre><code>import pandas as pd
  df = pd.DataFrame({'a':4, 'b':5, 'c':9}, index=[0])
  print(df)
  ##    a  b  c
  ## 0  4  5  9
  library(reticulate)
  df2 &lt;- reticulate::py$df
  print(df2)
  ##                                   a                                 b
  ## 1 &lt;environment: 0x000000001dddb808&gt; &lt;environment: 0x000000001decdc58&gt;
  ##                                   c
  ## 1 &lt;environment: 0x000000001e000918&gt;
  print(reticulate::py$df)
  ##                                   a                                 b
  ## 1 &lt;environment: 0x000000001e807f78&gt; &lt;environment: 0x000000001e8fd480&gt;
  ##                                   c
  ## 1 &lt;environment: 0x000000001e9ee608&gt;
  ```
  </code></pre>
  <p>Note, the dataframe prints correctly from python. Once we get into R, it appears as though the R dataframe object is corrupt.</p>
  <p>Here is my session information:</p>
  <pre><code>## R version 3.5.2 (2018-12-20)
  ## Platform: x86_64-w64-mingw32/x64 (64-bit)
  ## Running under: Windows 10 x64 (build 17134)
  ##  
  ## Matrix products: default
  ##  
  ## locale:
  ## [1] LC_COLLATE=English_United States.1252 
  ## [2] LC_CTYPE=English_United States.1252   
  ## [3] LC_MONETARY=English_United States.1252
  ## [4] LC_NUMERIC=C                          
  ## [5] LC_TIME=English_United States.1252    
  ##  
  ## attached base packages:
  ## [1] stats     graphics  grDevices utils     datasets  methods   base     
  ##  
  ## other attached packages:
  ## [1] reticulate_1.10.0.9004
  ##  
  ## loaded via a namespace (and not attached):
  ##  [1] Rcpp_1.0.0      lattice_0.20-38 digest_0.6.16   rprojroot_1.3-2
  ##  [5] grid_3.5.2      jsonlite_1.6    backports_1.1.2 magrittr_1.5   
  ##  [9] evaluate_0.11   stringi_1.1.7   Matrix_1.2-15   rmarkdown_1.10 
  ## [13] tools_3.5.2     stringr_1.3.1   yaml_2.2.0      compiler_3.5.2 
  ## [17] htmltools_0.3.6 knitr_1.20
  </code></pre>