Skip to content

Instantly share code, notes, and snippets.

@satishkt
Last active September 6, 2015 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satishkt/bd78e18844e3b0edb2d8 to your computer and use it in GitHub Desktop.
Save satishkt/bd78e18844e3b0edb2d8 to your computer and use it in GitHub Desktop.
gist_to_load_clean_data_file
def clean_data(filenames):
dfs=[]
for filename in filenames:
epic_df = pd.read_csv(filename,names=['col'],header=None)
epic_df['cuisine']=epic_df['col'].apply(lambda x : x.split('\t')[0])
epic_df['ingredients'] = epic_df['col'].apply(lambda x:(',').join (x.split('\t')[1:]))
epic_df.drop('col',inplace=True,axis=1)
dfs.append(epic_df)
return dfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment