Skip to content

Instantly share code, notes, and snippets.

@devamitranjan
Created December 15, 2020 17:07
Show Gist options
  • Save devamitranjan/372f7c9208f967bc23320e34cb577342 to your computer and use it in GitHub Desktop.
Save devamitranjan/372f7c9208f967bc23320e34cb577342 to your computer and use it in GitHub Desktop.
analysis = lambda polarity: 'Positive' if polarity > 0 else 'Neutral' if polarity == 0 else 'Negative'
def analysis_based_on_polarity(df):
df['Analysis'] = df['Polarity'].apply(analysis)
return df
df = analysis_based_on_polarity(df)
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment