Created
October 13, 2019 14:46
-
-
Save sorindragan/b29089806705e0f120c053876ec7aa94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sklearn.neighbors import KNeighborsRegressor | |
from sklearn.metrics import mean_squared_error | |
train = {'author': ['green', 'white'], | |
'age': [21, 34], | |
'pages': [100, 200], | |
} | |
train = pd.DataFrame(train) | |
print(train.head()) | |
features = ['pages', 'age'] | |
train_age = train.loc[train['age'].between(25, 34)] | |
print(train_age) | |
print(train_age[features]) | |
for i, d in train.iterrows(): | |
print(d[features]) | |
age = d['age'] | |
print(age) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment