Machine learning - what’s in a column project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Machine learning - what’s in a column project

Dear all, I used this following code: import pandas as pd filename = input('/usercode/files/one.csv \n') column_name = input('a') a=pd.read_csv(filename) b=a[column_name].values print('\n',b) but I cannot pass the test, I don’t understand why Could you help me? Thanks

31st Dec 2020, 11:40 AM
gugol
5 Answers
+ 2
import pandas as pd filename = input() column_name = input() df = pd.read_csv(filename) print(df[column_name].values)
10th May 2021, 9:47 AM
Reza Asgary
Reza Asgary - avatar
+ 1
clear what is inside input like: filename = input() column_name = input() and no need to use \n print(b)
31st Dec 2020, 12:32 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
0
thanks again
31st Dec 2020, 12:42 PM
gugol
0
can you give me the code you have use to this project😓
8th Nov 2021, 4:28 AM
G P Nethmina Yasas Rajapathirana
G P Nethmina Yasas Rajapathirana - avatar
0
Nethmina it took me a while to understand what was being said. You don't need to enter "https://sololearn.com/uploads/files/one.csv" Line 1 you need is one to import pandas as pd. Line 2 is the filename one just as it is. Line 3 is the column name, like line 2 it's provided and doesn't need any alterations. Line 4 is specifying what the datafile to be read is. The filename you need isn't actually one.csv you literally just put filename in the brackets. Line 5 is to print the value of the datafile with the column name (since column_name has been specified you just enter column_name). That's the best I can explain without actually giving the code.
24th Nov 2021, 11:54 PM
Katherine Longthorp
Katherine Longthorp - avatar