From 9632d4421cd3657315924f7dcac3d2f0e1621a19 Mon Sep 17 00:00:00 2001 From: e_ntyo Date: Mon, 7 Oct 2019 16:14:09 +0900 Subject: [PATCH] Use loc instead of ix ix will be deprecated --- linreg_happiness.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linreg_happiness.py b/linreg_happiness.py index 997534f..f33a722 100644 --- a/linreg_happiness.py +++ b/linreg_happiness.py @@ -6,8 +6,8 @@ happiness = d['Happiness.Score'] gdp = d['Economy..GDP.per.Capita.'] japanID = 50 -jhappiness = d.ix[japanID,'Happiness.Score'] -jgdp = d.ix[japanID, 'Economy..GDP.per.Capita.'] +jhappiness = d.loc[japanID,'Happiness.Score'] +jgdp = d.loc[japanID, 'Economy..GDP.per.Capita.'] lr = linear_model.LinearRegression() lr.fit(gdp.values.reshape((-1,1)), happiness.values) gdp_test = np.linspace(gdp.min(), gdp.max(), 10000) @@ -18,4 +18,4 @@ ax.scatter(gdp_test, happiness_predict, c='green', marker='.' , label='pred') ax.legend(loc='lower left') ax.set_xlabel('Economy..GDP.per.Capita.') -ax.set_ylabel('Happiness.Score') \ No newline at end of file +ax.set_ylabel('Happiness.Score')