0

Soy nuevo en python 3 y estoy haciendo un ejercicio para realizar un árbol de decisión por lo que ingrese la tabla a mano de la siguiente manera

ESTE ES EL CODIGO:

data = pd.DataFrame({
    "Outlook": ["Sunny", "Sunny", "Overcast", "Rain", "Rain", "Rain", "Overcast", "Sunny", 
    "Sunny", "Rain", "Sunny", "Overcast", "Overcast", "Rain"]
    "Temperature": ["Hot", "Hot", "Hot", "Mild", "Cool", "Cool", "Cool", "Mild", "Cool", 
    "Mild", "Mild", "Mild","Hot", "Mild"]
    "Humidity": ["High", "High", "High", "High", "Normal", "Normal", "Normal", "High", 
    "Normal", "Normal", "Normal", "High", "Normal", "High"]
    "Windy": ["False", "True", "False", "False", "False", "True", "True", "False", "False", 
             "False", "True", "True", "False", "True"]
    "Play golf": ["No", "No", "Yes", "Yes", "Yes", "No", "Yes", "No", "Yes", "Yes", "Yes", 
             "Yes", "Yes", "No"]
})

El error que me sale es: SyntaxError: invalid syntax. Perhaps you forgot a comma?

y lo marca en el primer corchete

1 respuesta 1

0

Te falta escribir una coma despues de cada par "string : lista".

data = pd.DataFrame({ 
    "Outlook": ["Sunny", "Sunny", "Overcast", "Rain", "Rain", "Rain", "Overcast", "Sunny", "Sunny", "Rain", "Sunny", "Overcast", "Overcast", "Rain"],
    "Temperature": ["Hot", "Hot", "Hot", "Mild", "Cool", "Cool", "Cool", "Mild", "Cool", "Mild", "Mild", "Mild","Hot", "Mild"],
    "Humidity": ["High", "High", "High", "High", "Normal", "Normal", "Normal", "High", "Normal", "Normal", "Normal", "High", "Normal", "High"], 
    "Windy": ["False", "True", "False", "False", "False", "True", "True", "False", "False", "False", "True", "True", "False", "True"], 
    "Play golf": ["No", "No", "Yes", "Yes", "Yes", "No", "Yes", "No", "Yes", "Yes", "Yes", "Yes", "Yes", "No"] 
})

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.