+ 1

Machine Learning - What’s in a column?

by this code I've passed 1 , but how can I improve my code to pass 2and other part of question import pandas as pd df = pd.read_csv('usercode/files/one.csv') arr = df[['a']].values print(arr[:,0])

1st Oct 2021, 8:10 PM
ff2023
ff2023 - avatar
5 Respostas
1st Oct 2021, 9:00 PM
Simon Sauter
Simon Sauter - avatar
0
1. For the task you have to take two inputs: one for the filename, one for the column_name. Instead you used the example input. 2. You need only one pair of square brackets in the definition of arr. 3. arr should be a one-dimensional array, so you can print it in it's entirety.
1st Oct 2021, 8:58 PM
Simon Sauter
Simon Sauter - avatar
0
1. Nos dan un archivo, por lo tanto debemos leerlo por medio de panda. 2. Convertimos en un array el nombre de la columna dada como segunda entrada usando ".values" 3. imprimimos todo el array espero ser de ayuda :) filename = input() column_name = input() import pandas as pd df = pd.read_csv(filename) arr = df[column_name].values print(arr[:])
13th Jan 2022, 8:31 PM
Daniel García Hernández
Daniel García Hernández - avatar
0
1. Nos dan un archivo, por lo tanto debemos leerlo por medio de panda. 2. Convertimos en un array el nombre de la columna dada como segunda entrada usando ".values" 3. imprimimos todo el array espero ser de ayuda :) filename = input() column_name = input() import pandas as pd df = pd.read_csv(filename) arr = df[column_name].values print(arr[:])
13th Jan 2022, 8:36 PM
Daniel García Hernández
Daniel García Hernández - avatar
0
Hi Fataneh Tabarteh Farahani #Just reorganize the code import pandas as pd #is important to start like this filename = input() #this was given column_name = input() #this was given df = pd.read_csv(filename) #to read the file arr = df[column_name].values #to get the data and output it as requested print(arr)
14th Jun 2022, 2:00 AM
Luzardo Lopez