vincekellner / demandforecasting

Forecast taxi demand for given areas in New York City
15 stars 2 forks source link

Vanilla autoencoder - issue with indexers #2

Closed juhariis closed 4 years ago

juhariis commented 4 years ago

An issue with vanilla autoencoder phase.

Note that I'm using Azure ML Studio with Python 3.6 and tensorflow: 2.1.0, keras: 2.3.1 so I had to change some calls to tensorflow into depreciatwed.v1 but that should not matter here

`

TypeError Traceback (most recent call last)

in 7 8 #area 237 training: 2009-2010, validation:2011 test:2012 ----> 9 ts_series_09_12_area237 = ts_10largest['2009':'2012'].iloc[:,0].copy() 10 ts_series_multivar = ts_10largest['2009':'2012'].iloc[:,:].copy() 11 /anaconda/envs/azureml_py36/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key) 2674 2675 # see if we can slice the rows -> 2676 indexer = convert_to_index_sliceable(self, key) 2677 if indexer is not None: 2678 return self._getitem_slice(indexer) /anaconda/envs/azureml_py36/lib/python3.6/site-packages/pandas/core/indexing.py in convert_to_index_sliceable(obj, key) 2324 idx = obj.index 2325 if isinstance(key, slice): -> 2326 return idx._convert_slice_indexer(key, kind='getitem') 2327 2328 elif isinstance(key, compat.string_types): /anaconda/envs/azureml_py36/lib/python3.6/site-packages/pandas/core/indexes/base.py in _convert_slice_indexer(self, key, kind) 1724 """ 1725 if self.is_integer() or is_index_slice: -> 1726 return slice(self._validate_indexer('slice', key.start, kind), 1727 self._validate_indexer('slice', key.stop, kind), 1728 self._validate_indexer('slice', key.step, kind)) /anaconda/envs/azureml_py36/lib/python3.6/site-packages/pandas/core/indexes/base.py in _validate_indexer(self, form, key, kind) 4143 pass 4144 elif kind in ['iloc', 'getitem']: -> 4145 self._invalid_indexer(form, key) 4146 return key 4147 /anaconda/envs/azureml_py36/lib/python3.6/site-packages/pandas/core/indexes/base.py in _invalid_indexer(self, form, key) 1861 "indexers [{key}] of {kind}".format( 1862 form=form, klass=type(self), key=key, -> 1863 kind=type(key))) 1864 1865 def get_duplicates(self): TypeError: cannot do slice indexing on with these indexers [2009] of `
vincekellner commented 4 years ago

Hi, the error refers to the wrong type of the index. The index has to be converted to "datetime" to slice the df with single strings such as '2010' etc.. I've updated the code to convert the type while reading the csv file.