Introductionβ
Today we released a tutorial explaining how to run an end-to-end implementation of GeoLift in Python leveraging the rpy2
package. This has been a frequently requested feature by the GeoLift community. Moreover, it is one that we believe is very important for the continued scaling of GeoLift in data-savvy organizations.
The goal of this tutorial is to empower Python users to run the GeoLift R functions in Python using the rpy2
package. The rpy2 is an open source library which enables calling R from Python. Itβs designed to facilitate the use of R by Python programmers.
GeoLift in Pythonβ
GeoLift is an end-to-end solution to measure Lift at a Geo-level using the latest developments in Synthetic Control Methods. Through this tutorial it is possible to run GeoLift R functions such as: Power Calculations, Inference, and Plots in Python.
There are 3 functions in Python under utils.py:
GeoLiftData
: Load and return the dataset included in the GeoLift package.ConvertDf
: Convert R dataframe into Pandas ifconv_type = "ToPandas"
or convert Pandas dataframe into R ifconv_type = "ToR"
.
GeoLiftPlot
: Receive a specific GeoLift Plot function (defined by thefunc
parameter), its arguments and display the plot.
To run the R GeoLift functions in Python, you need to add GeoLift.
in front of it as in GeoLift.GeoLiftMarketSelection()
. For example:
Start Your GeoLift in Python Now!ββ
You can access the GeoLift in Python tutorial in the GeoLiftPython folder hosted in the GeoLift github repository through this link. The README
file contains all the necessary information to start working with the Python version of GeoLift.