Skip to content

Instantly share code, notes, and snippets.

fig = px.bar(unigram_df[:20], x='ngram', y='count', title='Counts of top unigrams', template='plotly_white', labels={'ngram': 'Unigram', 'count': 'Count'})
fig.show()
fig = px.bar(bigram_df[:20], x='ngram', y='count', title='Counts of top bigrams', template='plotly_white', labels={'ngram': 'Bigram', 'count': 'Count'})
fig.show()
fig = px.bar(comp_grp_df, x='portion', y='company', template='plotly_white', orientation='h',
labels={'portion': '% of Complaints', 'bigram': 'Bigram', 'company': 'Company'},
color='bigram', color_discrete_sequence=px.colors.qualitative.Safe)
fig.update_layout(font=dict(size=10, color='DarkSlateGray'))
fig.update_layout(width=1200, height=500)
fig.show()
NAVBAR = dbc.Navbar(
children=[
html.A(
# Use row and col to control vertical alignment of logo / brand
dbc.Row(
[
dbc.Col(html.Img(src=PLOTLY_LOGO, height="30px")),
dbc.Col(
dbc.NavbarBrand("Bank Customer Complaints", className="ml-2")
),
fig = px.scatter(embed_df, x='tsne_1', y='tsne_2', hover_name='bigram', text='bigram', size='count', color='words', size_max=45
, template='plotly_white', title='Bigram similarity and frequency', labels={'words': 'Avg. Length<BR>(words)'}
, color_continuous_scale=px.colors.sequential.Sunsetdark)
fig.update_traces(marker=dict(line=dict(width=1, color='Gray')))
fig.update_xaxes(visible=False)
fig.update_yaxes(visible=False)
fig.show()
dbc.Row([
dbc.Col(['Choose a t-SNE perplexity value:'], md=6),
dbc.Col([
dcc.Dropdown(
id='bigrams-perplex-dropdown',
options=[{'label': str(i), 'value': i} for i in range(3, 7)],
value=3
)], md=3)
]),
dcc.Graph(id="bigrams-scatter"),
fig = px.bar(long_bigram_df_tidy, title='Comparision: ' + ngrams_list[0] + ' | ' + ngrams_list[1], x='ngram', y='value'
, color='variable', template='plotly_white', color_discrete_sequence=px.colors.qualitative.Bold
, labels={'variable': 'Company:', 'ngram': 'N-Gram'})
fig.update_layout(legend_orientation="h")
fig.update_layout(legend=dict(x=0.1, y=1.1))
fig.update_yaxes(title='', showticklabels=False)
fig.show()
>>> nf_df.head()
show_id type title director cast country date_added release_year rating duration listed_in description
0 81145628 Movie Norm of the North: King Sized Adventure Richard Finn, Tim Maltby Alan Marriott, Andrew Toth, Brian Dobson, Cole... United States, India, South Korea, China September 9, 2019 2019 TV-PG 90 min Children & Family Movies, Comedies Before planning an awesome wedding for his gra...
1 80117401 Movie Jandino: Whatever it Takes NaN Jandino Asporaat United Kingdom September 9, 2016 2016 TV-MA 94 min Stand-Up Comedy Jandino Asporaat riffs on the challenges of ra...
2 70234439 TV Show T
>>> nf_df.head()
show_id ... description
0 81145628 ... Before planning an awesome wedding for his gra...
1 80117401 ... Jandino Asporaat riffs on the challenges of ra...
2 70234439 ... With the help of three human allies, the Autob...
3 80058654 ... When a prison ship crash unleashes hundreds of...
4 80125979 ... When nerdy high schooler Dani finally attracts...
[5 rows x 12 columns]
# Avoid accidentally modifying the source object
nf_df = pd.read_csv('srcdata/netflix_titles.csv')
nf_test1_df = nf_df
nf_test1_df['like'] = True
print(len(nf_df.columns))
nf_df = pd.read_csv('srcdata/netflix_titles.csv')
nf_test2_df = nf_df
nf_test2_df = nf_test2_df.assign(like=True)
print(len(nf_df.columns))