Skip to content

Commit 3679885

Browse files
Merge pull request #185 from david-thrower/david-thrower-patch-2
Update regression-example-ames-no-preproc.py
2 parents 918a9f3 + 639ab87 commit 3679885

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

regression-example-ames-no-preproc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
###
1818

19+
LABEL_COLUMN = 'price'
20+
1921
## your data:
2022

2123

@@ -30,9 +32,11 @@
3032

3133
raw_data = pd.read_csv('ames.csv')
3234
needed_cols = [
33-
col for col in raw_data.columns if raw_data[col].dtype != 'object']
35+
col for col in raw_data.columns
36+
if raw_data[col].dtype != 'object'
37+
and col != LABEL_COLUMN]
3438
data_numeric = raw_data[needed_cols].fillna(0).astype(float)
35-
label = raw_data.pop('price')
39+
label = raw_data.pop(LABEL_COLUMN)
3640

3741
data_np = data_numeric.values
3842

0 commit comments

Comments
 (0)