Na hora de compilar apareceu esta msg de erro. Meu prog esta exatamente igual ao da vídeo aula.
KeyError Traceback (most recent call last) in 4 from sklearn.metrics import accuracy_score 5 ----> 6 x = dados[["preco", "idade_do_modelo", "km_por_ano"]] 7 y = dados["vendido"] 8
~\Anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 2984 if is_iterator(key): 2985 key = list(key) -> 2986 indexer = self.loc.convertto_indexer(key, axis=1, raise_missing=True) 2987 2988 # take() does not accept boolean indexers
~\Anaconda3\lib\site-packages\pandas\core\indexing.py in convertto_indexer(self, obj, axis, is_setter, raise_missing) 1283 # When setting, missing keys are not allowed, even with .loc: 1284 kwargs = {"raise_missing": True if is_setter else raise_missing} -> 1285 return self.getlistlike_indexer(obj, axis, **kwargs)[1] 1286 else: 1287 try:
~\Anaconda3\lib\site-packages\pandas\core\indexing.py in getlistlike_indexer(self, key, axis, raise_missing) 1090 1091 self.validateread_indexer( -> 1092 keyarr, indexer, o.getaxis_number(axis), raise_missing=raise_missing 1093 ) 1094 return keyarr, indexer
~\Anaconda3\lib\site-packages\pandas\core\indexing.py in validateread_indexer(self, key, indexer, axis, raise_missing) 1175 raise KeyError( 1176 "None of [{key}] are in the [{axis}]".format( -> 1177 key=key, axis=self.obj.getaxis_name(axis) 1178 ) 1179 )
KeyError: "None of [Index(['preco', 'idade_do_modelo', 'km_por_ano'], dtype='object')] are in the [columns]"