#Discover and visualize the data to gain insights

USA_Housing.plot(kind=“scatter”, x=“longitude”, y=“latitude”, alpha=0.4,
s=USA_Housing[“Area Population”]/100, label=“Area Population”, figsize=(10,7),
c=“median_house_value”, cmap=plt.get_cmap(“jet”), colorbar=True,
sharex=False)

KeyError Traceback (most recent call last)
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘longitude’

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
in
----> 1 USA_Housing.plot(kind=“scatter”, x=“longitude”, y=“latitude”, alpha=0.4,
2 s=USA_Housing[“Area Population”]/100, label=“Area Population”, figsize=(10,7),
3 c=“median_house_value”, cmap=plt.get_cmap(“jet”), colorbar=True,
4 sharex=False)

~\anaconda3\lib\site-packages\pandas\plotting_core.py in call(self, *args, **kwargs)
790 if kind in self._dataframe_kinds:
791 if isinstance(data, ABCDataFrame):
–> 792 return plot_backend.plot(data, x=x, y=y, kind=kind, **kwargs)
793 else:
794 raise ValueError(f"plot kind {kind} can only be used for data frames")

~\anaconda3\lib\site-packages\pandas\plotting_matplotlib_init_.py in plot(data, kind, **kwargs)
59 kwargs[“ax”] = getattr(ax, “left_ax”, ax)
60 plot_obj = PLOT_CLASSES[kind](data, **kwargs)
—> 61 plot_obj.generate()
62 plot_obj.draw()
63 return plot_obj.result

~\anaconda3\lib\site-packages\pandas\plotting_matplotlib\core.py in generate(self)
261 self._compute_plot_data()
262 self._setup_subplots()
–> 263 self._make_plot()
264 self._add_table()
265 self._make_legend()

~\anaconda3\lib\site-packages\pandas\plotting_matplotlib\core.py in _make_plot(self)
968 label = None
969 scatter = ax.scatter(
–> 970 data[x].values,
971 data[y].values,
972 c=c_values,

~\anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key)
2798 if self.columns.nlevels > 1:
2799 return self._getitem_multilevel(key)
-> 2800 indexer = self.columns.get_loc(key)
2801 if is_integer(indexer):
2802 indexer = [indexer]

~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘longitude’

How can i fix it?

Please reply.

plt.legend()

[quote=“NIRAV_RAJ, post:1, topic:6751”]
How can i fix it?

How can i fix it?

Please reply.

Hi Nirav, I tried calling you yesterday (November 11th) a number of times to understand the issues that you were facing but was unable to reach you. I had sent you an email asking for a time when I can speak to you, however, I never got any response from your end.

Please note that this is not a project from CloudxLab that you are trying to attempt. So without looking at the dataset, or your code, it is impossible for us to provide a solution to the error that you are getting. I would suggest you to refer to my comment to your previous post for a probable solution, here is the link to the same:

You can also refer to the End-to-End Project lecture videos and Jupyter notebooks for more information on this as you have already enrolled for the Machine Learning Specialization course. That should help you understand these issues, and how to solve them.

I am sorry for that.

I did not see my email that is my fault.

I feel sorry for that.

My phone is <deleted>
this is my number

actually my gmail is showing suspecius that is why i could

not login from some days.I am looking into this matter.

Thank you for that.

The data i am using longitude is not given there.

longitude column has not given in my data set.

So what value should i take instead of that.

Please reply

This the site from where i downloaded my dataset USA_housing

Please see this
https://github.com/mohitpawar473/USA-Housing-Datase

Hi Nirav, please check my email and schedule a meeting accordingly. Thanks.

Please give me the link.

I checked my email but I didn’t get any link.

Please give me the link