The reticulate package provides a comprehensive set of tools fot interoperability between Python and R.
# Data Preprocessing Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# print(r.df.head())
# Importing the dataset
df = pd.read_csv(r"C:\07 - R Website\dataset\PY\Salary_Data.csv") # load the data
df.head(10) # show firt 10 observations
#
# Preprocessing Input data
## YearsExperience Salary
## 0 1.1 39343.0
## 1 1.3 46205.0
## 2 1.5 37731.0
## 3 2.0 43525.0
## 4 2.2 39891.0
## 5 2.9 56642.0
## 6 3.0 60150.0
## 7 3.2 54445.0
## 8 3.2 64445.0
## 9 3.7 57189.0
X = df.iloc[:, 0]
Y = df.iloc[:, 1]
# plt.scatter(X, Y)
# plt.show()