ageron / ageron/handson-ml2

[QUESTION]-Chap3 Classification

Abierto
#536 2 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Jupyter Notebook
Estrellas
30k
Forks
13.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**KeyError: 0** is thrown as an error while the below set of code is executed.

```
import matplotlib as mpl
import matplotlib.pyplot as plt
digit = x[0]

digit = digit.reshape(28, 28)

plt.imshow(digit, cmap="binary")
plt.axis("off")
plt.show()
```

Full stacktrace here:

```
KeyError Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py](https://localhost:8080/#) in get_loc(self, key, method, tolerance)
3360 try:
-> 3361 return self._engine.get_loc(casted_key)
3362 except KeyError as err:

4 frames
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: 0

The above exception was the direct cause of the following exception:

KeyError Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py](https://localhost:8080/#) in get_loc(self, key, method, tolerance)
3361 return self._engine.get_loc(casted_key)
3362 except KeyError as err:
-> 3363 raise KeyError(key) from err
3364
3365 if is_scalar(key) and isna(key) and not self.hasnans:

KeyError: 0

```

**Expected behavior**

Should print a image as below
Screenshot 2022-02-03 at 10 56 22 AM

**Screenshot**
Screenshot 2022-02-03 at 10 54 52 AM

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.