Import Matlab Data
Some data that is provided by universities appears as a .mat file. These file type is unique to matplotlib and can be imported via the io function in the Scipy Python package. See an example below using the Forset Cover dataset.
Import Prelimnaries¶
# Import Modules
import pandas as pd
from scipy import io
# Set Pandas Configuration
pd.set_option('max_columns', 1000)
pd.set_option('max_rows', 1000)
Import MAT File¶
# Import Mat File
data = io.loadmat('Data/ForestCover/cover.mat')
# Create Dataframe of the File
df = pd.concat([pd.DataFrame(data['X']), pd.DataFrame(data['y'], columns=['target'])], axis =1)
df.head()
Author: Kavi Sekhon