Machine Learning Project One | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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)

29th Aug 2022, 6:09 PM
Vlad Giurgiu
Vlad Giurgiu - avatar
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
29th Aug 2022, 8:35 PM
Jan
Jan - avatar
+ 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.
29th Aug 2022, 6:31 PM
Jan
Jan - avatar
+ 1
Quantum I did not know that, thanks. Knowing that fixed everything.
29th Aug 2022, 10:42 PM
Vlad Giurgiu
Vlad Giurgiu - avatar
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)
29th Aug 2022, 7:41 PM
Vlad Giurgiu
Vlad Giurgiu - avatar