// we then get the data, and define a target column we will try to predict,
// as well as a dirty colum we will encode with the different methods.
// the rest will have a standard encoding
data_path = fetching.get_data_dir()
fetching.fetch_employee_salaries()
data_file = os.path.join(data_path, "employee_salaries", "rows.csv")
df = pd.read_csv(data_file).astype(str)
df["Current Annual Salary"] = [float(s[1:]) for s
in df["Current Annual Salary"]]
df["Year First Hired"] = [int(s.split("/")[-1])
for s in df["Date First Hired"]]
target_column = "Current Annual Salary"
y = df[target_column].values.ravel()
After Change
df["Current Annual Salary"] = df["Current Annual Salary"].str.strip("$").astype(
float)
df["Date First Hired"] = pd.to_datetime(df["Date First Hired"])
df["Year First Hired"] = df["Date First Hired"].apply(lambda x: x.year)
target_column = "Current Annual Salary"
y = df[target_column].values.ravel()