+ 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
5 Antworten
+ 2
import pandas as pd
filename = input()
column_name = input()
df = pd.read_csv(filename)
print(df[column_name].values)
+ 1
clear what is inside input like:
filename = input()
column_name = input()
and no need to use \n
print(b)
0
thanks again
0
can you give me the code you have use to this project😓
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.