Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
345 B
2
Indexable
Never
import pandas as pd
from sklearn.datasets import load_boston
bs=load_boston()
df = pd.DataFrame(bs.data,columns=bs.feature_names)
s_age_less_10_for_each_rad = df.groupby('RAD').max()['AGE'] - 10
for rad in s_age_less_10_for_each_rad.index:
    df_temp = df.loc[(df.RAD==rad) & (df.AGE>=s_age_less_10_for_each_rad[rad])]
    print(df_temp)