- 3
Machine Learning | The Basics: 10 Code Project
Getting a column from a numpy array. Task Given a csv file and a column name, print the elements in the given column. Input Format First line: filename of a csv file Second line: column name Output Format Numpy array Sample Input https://sololearn.com/uploads/files/one.csv a File one.csv contents: a,b 1,3 2,4 Sample Output [1 2]
1 Answer
- 1
filename = input()
column_name = input()
import pandas as pd
import numpy as np
a = pd.read_csv(filename)
b = a[column_name]
#print(a.describe())
#print(a.head())
print(np.array(b))
'''
Good Luck
'''