Machine learning - what’s in a column project | Sololearn: Learn to code for FREE!


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

12/31/2020 11:40:37 AM


5 Answers

New Answer


clear what is inside input like: filename = input() column_name = input() and no need to use \n print(b)


thanks again


import pandas as pd filename = input() column_name = input() df = pd.read_csv(filename) print(df[column_name].values)


can you give me the code you have use to this project😓


Nethmina it took me a while to understand what was being said. You don't need to enter "" 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.