Python Forum
'AxesSubplot' object is not subscriptable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'AxesSubplot' object is not subscriptable
#1
i am trying to run a corelation. code is:

df[["sqft_living","price"]].corr()

i get following error: can someone please help.

Error:
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-33-53edee4cd1ce> in <module> 2 height = 8 3 plt.figure(figsize=(width, height)) ----> 4 sns.regplot(x="sqft_above", y="price", data=df) 5 plt.ylim(0,) ~/conda/envs/python/lib/python3.6/site-packages/seaborn/regression.py in regplot(x, y, data, x_estimator, x_bins, x_ci, scatter, fit_reg, ci, n_boot, units, order, logistic, lowess, robust, logx, x_partial, y_partial, truncate, dropna, x_jitter, y_jitter, label, color, marker, scatter_kws, line_kws, ax) 779 order, logistic, lowess, robust, logx, 780 x_partial, y_partial, truncate, dropna, --> 781 x_jitter, y_jitter, color, label) 782 783 if ax is None: ~/conda/envs/python/lib/python3.6/site-packages/seaborn/regression.py in __init__(self, x, y, data, x_estimator, x_bins, x_ci, scatter, fit_reg, ci, n_boot, units, order, logistic, lowess, robust, logx, x_partial, y_partial, truncate, dropna, x_jitter, y_jitter, color, label) 103 # Extract the data vals from the arguments or passed dataframe 104 self.establish_variables(data, x=x, y=y, units=units, --> 105 x_partial=x_partial, y_partial=y_partial) 106 107 # Drop null observations ~/conda/envs/python/lib/python3.6/site-packages/seaborn/regression.py in establish_variables(self, data, **kws) 46 for var, val in kws.items(): 47 if isinstance(val, string_types): ---> 48 setattr(self, var, data[val]) 49 elif isinstance(val, list): 50 setattr(self, var, np.asarray(val)) TypeError: 'AxesSubplot' object is not subscriptable
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 738 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  Help with python 'not subscriptable' error Extra 3 2,085 Dec-16-2022, 05:55 PM
Last Post: woooee
  TypeError: 'NoneType' object is not subscriptable syafiq14 3 5,244 Sep-19-2022, 02:43 PM
Last Post: Larz60+
  'int' object is not subscriptable after API call ed8484 1 1,806 Sep-18-2021, 02:06 PM
Last Post: ed8484
  Message='int' object is not subscriptable DanielCook 4 2,306 Aug-10-2021, 05:21 PM
Last Post: deanhystad
  Bool Object is not Subscriptable quest 1 4,142 May-02-2021, 11:12 AM
Last Post: Yoriz
  Float Object is not Subscriptable quest 2 2,888 Apr-20-2021, 09:28 AM
Last Post: quest
  TypeError: 'NoneType' object is not subscriptable Jmekubo 6 27,313 Sep-08-2020, 10:03 AM
Last Post: DigiTMG
  TypeError: 'type' object is not subscriptable Stef 1 4,516 Aug-28-2020, 03:01 PM
Last Post: Gribouillis
  'NoneType' object is not subscriptable Justchse 4 3,698 Aug-01-2020, 06:18 PM
Last Post: Justchse

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020