0
I am trying to run this code nhttps://colab.research.google.com and gives this error.
# Preprocessing function #n está funcionando :(
def preprocess(data, columns_to_ignore):
# Sort by descending id and delete columns
for id in sorted(columns_to_ignore, reverse=True):
[r.pop(id) for r in data]
for i in range(len(data)):
# Converting 'sex' field to float (id is 1 after removing labels column)
data[i][1] = 1. if data[i][1] == 'female' else 0.
return np.array(data, dtype=np.float32)
# Ignore 'name' and 'ticket' columns (id 1 & 6 of data array)
to_ignore=[1, 6]
# Preprocess data
data = preprocess(data, to_ignore)
For documentation, the guy
numpy.ndarray
, in fact, it does not have the methodpop()
. Its objectr
should be this kind?– Woss
I’m not sure, I’m following this tutorial https://colab.research.google.com/drive/1D0HyGpI1M_Eqh_GR3KOG3k7Skr2gfxJO#scrollTo=mBkYXqvMQ29c, http://learntf.org/tutorials/quickstart.html
– Raul Nascimento
looks like the code was meant to work with lists of lists, and you’re passing a
numpy.array
...– nosklo
It usually works here https://repl.it/@hedgtyhedgty/Titanic-NN
– Raul Nascimento