R and Python

Author

Bruno Rodrigues

Published

October 27, 2022

This is a simple quarto document

library(dplyr)
library(tidyr)
library(purrr)
library(ggplot2)
library(myPackage)

data("unemp")

unemp <- unemp %>%
  janitor::clean_names() %>%
  filter(level == "Commune")

The data that was loaded and cleaned from R can be accessed from Python using r.unemp:

import pandas as pd
unemp_pd = pd.DataFrame(r.unemp)
unemp_pd.head
<bound method NDFrame.head of        year         place_name  ... active_population  unemployment_rate_in_percent
0    2013.0            Dippach  ...            1817.0                      6.274078
1    2013.0            Garnich  ...             869.0                      2.876870
2    2013.0          Hobscheid  ...            1505.0                      4.916944
3    2013.0           Kaerjeng  ...            4355.0                      5.993111
4    2013.0             Kehlen  ...            2244.0                      4.367201
..      ...                ...  ...               ...                           ...
310  2015.0  Mondorf-les-Bains  ...            2083.0                      8.305329
311  2015.0             Remich  ...            1550.0                      7.741935
312  2015.0           Schengen  ...            2173.0                      3.819604
313  2015.0      Stadtbredimus  ...             891.0                      5.723906
314  2015.0       Waldbredimus  ...             460.0                      4.347826

[315 rows x 9 columns]>