huber.py
import numpy as np
import pandas as pd

n = 100 # Total data points

# (x, y) data
x = np.random.standard_normal(n)
y = 2.0 * x + 1.0 * np.random.standard_normal(n)

# Convert to DataFrame
df = pd.DataFrame({"x":x, "y": y})

# add outliers
df.loc[df.shape[0]-2] = [8, -7]
df.loc[df.shape[0]-1] = [7.9, -7.3]