joseramoncajide
9/27/2016 - 12:22 PM

r_python


# coding: utf-8

# In[ ]:

import warnings
warnings.filterwarnings('ignore')


# In[ ]:

get_ipython().system('pip install rpy2')


# In[ ]:

get_ipython().magic('load_ext rpy2.ipython')


# In[ ]:

get_ipython().magic('R require(data.table)')


# In[ ]:

get_ipython().magic("R path_to_transactions <- file.path('..','..','git','eam_clientes','zara','customer_segmentation','data')")
get_ipython().magic("R transactions_file <- file.path(path_to_transactions, 'ZARA_ES_RFM.csv')")
get_ipython().magic("R DT <- fread(transactions_file, na.strings = c('\\\\N'))")


# In[ ]:

get_ipython().magic('Rpull DT')


# In[ ]:

from rpy2.robjects import pandas2ri

DT = pandas2ri.ri2py_dataframe(DT)


# In[ ]:

get_ipython().magic('R rm(DT)')


# In[ ]:

DT.head()


# In[ ]:

#%R install.packages('KMsurv')
get_ipython().magic("R library('KMsurv')")
get_ipython().magic('R data(tongue)')


# In[ ]:

get_ipython().magic('R tail(tongue)')


# In[ ]: