0
0
ML Pythonprogramming~10 mins

Loading datasets (CSV, built-in datasets) in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load a CSV file into a pandas DataFrame.

ML Python
import pandas as pd

data = pd.read_csv([1])
Drag options to blanks, or click blank then click option'
Aread_csv('data.csv')
Bdata.csv
C'data.csv'
Dpd.read_csv('data.csv')
Attempts:
3 left
2fill in blank
medium

Complete the code to load the Iris dataset from sklearn.

ML Python
from sklearn import datasets

iris = datasets.[1]()
Drag options to blanks, or click blank then click option'
Aload_iris
Bfetch_iris
Cget_iris
Diris_data
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to load a CSV file with pandas and display the first 5 rows.

ML Python
import pandas as pd

df = pd.read_csv('data.csv')
print(df.[1]())
Drag options to blanks, or click blank then click option'
Ashow
Bfirst
Ctop
Dhead
Attempts:
3 left
4fill in blank
hard

Fill both blanks to load the digits dataset and get its data and target arrays.

ML Python
from sklearn import datasets

digits = datasets.[1]()
data = digits.[2]
Drag options to blanks, or click blank then click option'
Aload_digits
Bfetch_digits
Cdata
Dtarget
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to load the wine dataset, get its features and labels.

ML Python
from sklearn.datasets import [1]

wine = [1]()
features = wine.[2]
labels = wine.[3]
Drag options to blanks, or click blank then click option'
Aload_wine
Bdata
Ctarget
Dfetch_wine
Attempts:
3 left