Skip to content

Instantly share code, notes, and snippets.

@shubham1710
Created June 21, 2020 10:51
Show Gist options
  • Save shubham1710/ed3cd60a3c6f52fa27f1ee6f7cac88df to your computer and use it in GitHub Desktop.
Save shubham1710/ed3cd60a3c6f52fa27f1ee6f7cac88df to your computer and use it in GitHub Desktop.
movie = pd.read_csv("moviedata.csv")
features = ['keywords','cast','genres','director','tagline']
for feature in features:
movie[feature] = movie[feature].fillna('')
def combine_features(row):
try:
return row['keywords'] +" "+row['cast']+" "+row['genres']+" "+row['director']+" "+row['tagline']
except:
print ("Error:", row)
movie["combined_features"] = movie.apply(combine_features,axis=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment