I have a CSV
file with salary information and other columns.
I am trying to transform some of these columns into proper values, for a LinearRegression
and a SGDRegressor
, or some other. Because, I don't think that the LinearRegression
in sklearn
can handle the data bits as is.
Data:
- 607 records
- Numerical columns: year, salary, salary in USD
- Categorical columns: experience, type, residence, currency, remote work, company location, and company size.
- Target: salary in USD
Encoding:
# Import neccessary encoder
from sklearn.preprocessing import OneHotEncoder
# Encoding of categorical data
encoder = OneHotEncoder(sparse=False)
# Extract columns
columns = data[['Experience', 'Type', 'Residence', 'Remote work', 'Company location', 'Company size']]
Questions:
- How to group any data within the categories (to avoid duplicates)?
- Is
OneHotEncoder
the recommended way of doing this?
currency
in your extract columns. $\endgroup$