<jupyter_start><jupyter_text>Appetizers * ***Main ***<jupyter_code>df = pd.read_csv('APP_main.csv')
df1 = pd.read_csv('APP_main_1.csv')
df2 = pd.read_csv('APP_main_2.csv')
df3 = pd.read_csv('APP_main_3.csv')
print df1.shape
df3.head()
df = df.drop('Unnamed: 0', 1)
print df1.shape
df1 = df1.drop('Unnamed: 0', 1)
df1.head(3)
print df2.shape
df2 = df2.drop('Unnamed: 0', 1)
df2.head(3)
print df3.shape
df3 = df3.drop('Unnamed: 0', 1)
df3.head(3)
#concatenate the main tables. 
APP_main= pd.concat([df, df1, df2, df3])
#peek at dataframe
print APP_main.shape
APP_main.id.duplicated().sum()
for i in APP_main.duplicated('id'):
    if i == True:
        print i<jupyter_output><empty_output><jupyter_text>* ***Flavors***<jupyter_code>fdf = pd.read_csv('APP_flavors.csv')
fdf1 = pd.read_csv('APP_flavors_1.csv')
fdf2 = pd.read_csv('APP_flavors_2.csv')
fdf3 = pd.read_csv('APP_flavors_3.csv')
print fdf.shape
fdf = fdf.drop('Unnamed: 0', 1)
fdf = fdf.rename(columns = {'index':'id'})
fdf.head(3)
print fdf1.shape
fdf1 = fdf1.drop('Unnamed: 0', 1)
fdf1.head(3)
#change column name index to id
fdf1=fdf1.rename(columns= {'index': 'id'})
fdf1.columns
print fdf2.shape
fdf2 = fdf2.drop('Unnamed: 0', 1)
fdf2 = fdf2.rename(columns = {'index':'id'})
fdf2.head(3)
print fdf3.shape
fdf3 = fdf3.drop('Unnamed: 0', 1)
fdf3 = fdf3.rename(columns = {'index':'id'})
fdf3.head(3)
#concatenate the flavor tables. 
APP_flavors= pd.concat([fdf, fdf1, fdf2, fdf3])
#peek at dataframe
print APP_flavors.shape
APP_flavors.head(3)
for i in APP_flavors.duplicated('id'):
    if i == True:
        print i<jupyter_output><empty_output><jupyter_text>* ***Cuisine***<jupyter_code>cdf = pd.read_csv('APP_cuisines.csv')
cdf1 = pd.read_csv('APP_cuisines_1.csv')
cdf2 = pd.read_csv('APP_cuisines_2.csv')
cdf3 = pd.read_csv('APP_cuisines_3.csv')
print cdf.shape
cdf = cdf.drop('Unnamed: 0', 1)
cdf = cdf.rename(columns = {'index':'id'})
print cdf.columns
cdf.head(3)
print cdf1.shape
cdf1 = cdf1.drop('Unnamed: 0', 1)
print cdf1.columns
cdf1.head(3)
#change column name index to id
cdf1=cdf1.rename(columns= {'index': 'id'})
cdf1.columns
print cdf2.shape
cdf2 = cdf2.drop('Unnamed: 0', 1)
cdf2 = cdf2.rename(columns = {'index':'id'})
print cdf2.columns
cdf2.head(3)
print cdf3.shape
cdf3 = cdf3.drop('Unnamed: 0', 1)
cdf3 = cdf3.rename(columns = {'index':'id'})
print cdf3.columns
cdf3.head(3)
#concatenate the cuisine tables. 
APP_cuisines= pd.concat([cdf, cdf1, cdf2, cdf3])
#peek at dataframe
print APP_cuisines.shape
APP_cuisines.head(3)
for i in APP_cuisines.duplicated('id'):
    if i == True:
        print i<jupyter_output><empty_output><jupyter_text>* ***Details***<jupyter_code>ddf = pd.read_csv('APP_details.csv')
ddf1 = pd.read_csv('APP_details_1.csv')
ddf2 = pd.read_csv('APP_details_2.csv')
ddf3 = pd.read_csv('APP_details_3.csv')
print ddf.shape
ddf = ddf.drop('Unnamed: 0', 1)
print ddf.columns
ddf.head(3)
print ddf1.shape
ddf1 = ddf1.drop('Unnamed: 0', 1)
print ddf1.columns
ddf1.head(3)
print ddf2.shape
ddf2 = ddf2.drop('Unnamed: 0', 1)
print ddf2.columns
ddf2.head(3)
print ddf3.shape
ddf3 = ddf3.drop('Unnamed: 0', 1)
print ddf3.columns
ddf3.head(3)
#concatenate the details tables. 
APP_details= pd.concat([ddf, ddf1, ddf2, ddf3])
#peek at dataframe
print APP_details.shape
APP_details.head(3)
for i in APP_details.duplicated('id'):
    if i == True:
        print i<jupyter_output><empty_output><jupyter_text>* ***Ingredients***<jupyter_code>idf = pd.read_csv('APP_ingredients.csv')
idf1 = pd.read_csv('APP_ingredients_1.csv')
idf2 = pd.read_csv('APP_ingredients_2.csv')
idf3 = pd.read_csv('APP_ingredients_3.csv')
print idf.shape
idf = idf.drop('Unnamed: 0', 1)
print idf.columns
idf.head(3)
print idf1.shape
idf1 = idf1.drop('Unnamed: 0', 1)
print idf1.columns
idf1.head(3)
print idf2.shape
idf2 = idf2.drop('Unnamed: 0', 1)
print idf2.columns
idf2.head(3)
print idf3.shape
idf3 = idf3.drop('Unnamed: 0', 1)
print idf3.columns
idf3.head()
#concatenate the ingredient tables. 
APP_ing= pd.concat([idf, idf1, idf2, idf3])
APP_ing.head(3)
#drop unnamed column & make id first column
#APP_ing = APP_ing.drop('Unnamed: 0', 1)
cols = list(APP_ing)
cols.insert(0, cols.pop(cols.index('id')))
APP_ing = APP_ing.ix[:, cols]
APP_ing.head(3)
for i in APP_ing.duplicated('id'):
    if i == True:
        print i<jupyter_output><empty_output><jupyter_text>Join all tables for Appetizers<jupyter_code># set index to column 'id'
_df = [APP_main, APP_cuisines, APP_flavors, APP_details, APP_ing]

for df in _df:
    df.set_index('id', inplace = True)
# join dataframes
APP_data = APP_main.join([APP_cuisines, APP_flavors, APP_details, APP_ing])
# add course column
APP_data['course'] = 'Appetizer'
APP_data.shape
APP_data.head(3)
#save to csv
APP_data.to_csv('APP_data.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1645039765592298, 'fraction_numerical': 0.04123064043532859, 'mean_word_length': 5.674581005586592, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '186494', 'license': 'MIT', 'n_tokens_mistral': 2195, 'n_tokens_neox': 2126, 'n_words': 418, 'path': 'APPETIZER/.ipynb_checkpoints/APP_CONCATENATE_DATAFRAMES-checkpoint.ipynb', 'repo_name': 'babebe/Yummly', 'size': '4778'}