In [47]:
import pandas as pd
from os import listdir
In [2]:
!ls ../raw_data/
In [40]:
# Sample Data Raw
sample_df = pd.read_csv('../raw_data/sample_submission.csv')
print len(sample_df)
sample_df.head(1)
Out[40]:
In [38]:
col_map = {
'c0' : 'safe driving',
'c1' : 'texting - right',
'c2' : 'talking on the phone - right',
'c3': 'texting - left',
'c4': 'talking on the phone - left',
'c5': 'operating the radio',
'c6': 'drinking',
'c7': 'reaching behind',
'c8': 'hair and makeup',
'c9': 'talking to passenger'
}
sample_df.rename(columns=col_map).head(1)
Out[38]:
In [45]:
img_list_df = pd.read_csv('../raw_data/driver_imgs_list.csv')
print len(img_list_df)
img_list_df.head(1)
Out[45]:
In [ ]:
In [56]:
!ls ../raw_data/imgs/
Train Directory:
Class Directory Summary
In [62]:
train_path = '../raw_data/imgs/train/'
train_files = listdir(train_path)
print len(train_files)
train_files
Out[62]:
In [105]:
train_file_df = pd.DataFrame(columns=['file_path', 'class'])
for clas in train_files:
class_files = listdir(train_path+clas+'/')
if '.DS_Store' in class_files:
class_files.remove('.DS_Store')
# Create Dataframe with all files needed
train_file_df = train_file_df.append(
pd.DataFrame(zip([train_path+clas+'/'+f for f in class_files], [clas for _ in xrange(len(class_files))])
, columns=['file_path', 'class'])
)
In [108]:
train_file_df.head(2)
Out[108]:
In [ ]:
In [ ]:
Test Directory
In [ ]: