- 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]

2nd May 2022, 9:45 PM
Fare Jare
Fare Jare - avatar
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 '''
3rd May 2022, 12:46 AM
SoloProg
SoloProg - avatar