How to do it...

Execute the following steps to load a dataset into Python.

  1. Import the libraries:
import pandas as pd
  1. Preview a CSV file:
!head -n 5 credit_card_default.csv

The output looks like this:

  1. Load the data from the CSV file:
df = pd.read_csv('credit_card_default.csv', index_col=0, 
na_values='')

The DataFrame has 30,000 rows and 24 columns.

  1. Separate the features from the target:
X = df.copy()
y = X.pop('default_payment_next_month')

After running this block of code, X no longer contains the target column.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.154.121