Dataset: fandango_score_comparison.csv
I'm trying to access a row that matches a given movie name using the following code:
df = pd.read_csv("http://github.com/mircealex/Movie_ratings_2016_17/raw/master/fandango_score_comparison.csv")
df.drop_duplicates(subset=["FILM"], inplace=True, ignore_index=True)
movie_name = df.FILM.iloc[0]
movie_df = df[df["FILM"].str.contains(movie_name)]
But the movie_df I get is always empty, irrespective of the movie_name I select. What am I missing or doing wrongly?
df[df["FILM"].str.contains(movie_name), regex=False]. contains assumes the argument is a regular expression. Your first movie name may accidentally be a valid regex.df[df["FILM"].str.contains(movie_name, regex=False)].