0
Machine Learning Project One
Bug prompts exceptions while pandas reads csv file. I'm not sure what I'm doing wrong but it seems as soon as the code runs to the line that reads the csv file, it terminates from many errors. What am I doing wrong? filename = 'https://sololearn.com/uploads/files/one.csv' column_name = 'a' import pandas as pd import numpy as np df = pd.read_csv(filename)
4 Answers
+ 1
Vlad Giurgiu The input should be empty like this - input() - because the contents is provided by Sololearn to the input function.
You also need an empty input() for the column_name
+ 1
You should use input() as expression for the filename, and import pandas should be on top. You don't need to import numpy to solve the task.
+ 1
Quantum
I did not know that, thanks. Knowing that fixed everything.
0
Quantum
This should have done it and mostly fixed the issue. I'm getting the [1 2] output, but before it there is a website that gets printed in the output "http://../Playground/" which makes the code incorrect.
import pandas as pd
filename = input('https://sololearn.com/uploads/files/one.csv')
column_name = input('a')
df = pd.read_csv(filename)
print(df[column_name].values)