Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
AttributeError Traceback (most recent call last)
<ipython-input-3-a2149c60e478> in <module>
4 from shapely.geometry import MultiPoint
5 df = pd.read_csv(r"D:\sandy\data\cairns-nov2019-data_2.csv")
----> 6 coords = df.as_matrix(columns=['Latitude','Longitude'])
~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.__getattribute__(self, name)
5276 def __setattr__(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'as_matrix'
Change that line to:
coords = df[["Latitude", "Longitude"]].values