KWB-R / flextreat.hydrus1d

Soil Water Balance and Solute Transport Modelling Scenarios for Project Flextreat
https://kwb-r.github.io/flextreat.hydrus1d
MIT License
0 stars 0 forks source link

Problems importing with pandas Multiindex dataframe with reticulate #1

Closed mrustl closed 2 years ago

mrustl commented 2 years ago

As pointed out here (https://github.com/rstudio/reticulate/issues/846), dealing with Multiindex pandas dataframes (https://github.com/phydrus/phydrus/blob/7359feb7adcaeb9d014d9b53c343b24418690e31/phydrus/model.py#L1492), i.e. conversion to R object, is not possible yet:

m <- ml$get_empty_material_df(n = 2)
m
>    water                          solute                       
>      thr  ths Alfa    n   Ks    l bulk.d DisperL frac mobile_wc
>1.0   0.0  0.0  0.0  0.0  0.0  0.0    0.0     0.0  0.0       0.0
>2.0   0.0  0.0  0.0  0.0  0.0  0.0    0.0     0.0  0.0       0.0

m_r <- reticulate::py_to_r(m)
m_r

>  water   thr               ths               Alfa              n                 Ks                l         solute  bulk.d   
>1                 0                 0                 0                 0                 0                 0                 0
>2                 0                 0                 0                 0                 0                 0                 0
>         DisperL           frac              mobile_wc
>1                 0                 0                 0
>2                 0                 0                 0

Thus I do not know how to adapt the parameters of m correctly now from R, so it may be easier to switch to python Rmarkdown

mrustl commented 2 years ago

As I now moved to my own R wrapper package kwb.hydrus1d instead of python a fix is not needed anymore