Python Dataframe Conversion to R Dataframe

Greetings RStudio Community,

I need a help regarding Python and R interoperability,
here is the case, i need to read pickle file and loaded into R, i use code like this

import pandas as pd
import numpy as np
df = pd.DataFrame({'ID':['001','002',np.nan,'004'],
'Name':['Jim', 'Nau', 'Klos','Axe'],
'Date':['3/1/2020',np.nan,'4/5/2020','5/4/2020']} )

df['Date'] = pd.to_datetime(df['Date'])
df['Date2'] = df['Date']
# Save To Pickle
pd <- import("pandas")
df <- pd$read_pickle('~/Test.pkl')
df %>% select(Date2) %>% slice(1) %>% pull()
df %>% tidyr::unnest(Date2)

The pickle file is loaded into R, but seems for several column were turned to list
ID <list> "001", "002", NaN, "004" Name "Jim", "Nau", "Klos", "Axe"
Date <dttm> 2020-03-01 07:00:00, NA, 2020-04-05 07:00:00, 2020-05-04 07:00:00 Date2 <<environment: 0x00000177a2f8c578>>, <<environment: 0x00000177a2f98188~

for Column ID i can convert it by convert to characters first then unnest it, but for Date2 that seen as memory address i cannot unnest it although when i extract that column its appear it value, its said

Error: Input must be list of vectors

How to unnest list column with memory address like that ?

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.