twitterpersona.generate_word_cloud

Module Contents

Functions

transform_zeros(val)

Helper function to correct the mask array.

set_colourmap(df)

Determine the corresponding colourmap for a certain users

create_wordcloud(df)

Create a wordcloud out of all the tweets of a user.

twitterpersona.generate_word_cloud.transform_zeros(val)[source]

Helper function to correct the mask array.

Parameters:

val (int) – Any integer.

Returns:

val – 255 if val is 0, and val otherwise.

Return type:

int

Examples

transform_zeros(0)

twitterpersona.generate_word_cloud.set_colourmap(df)[source]

Determine the corresponding colourmap for a certain users tweet sentiment analysis.

Parameters:

df (pd.DataFrame) – A dataframe with all the tweets of a user, and their sentiment analysis.

Returns:

plot – A matplotlib plot of the wordcloud.

Return type:

plt.figure()

Examples

set_colourmap(df)

twitterpersona.generate_word_cloud.create_wordcloud(df)[source]

Create a wordcloud out of all the tweets of a user. Wordcloud colour is green if the overal sentiment of the users tweets is positive, red if negative and blue if neutral.

Parameters:

df (pd.DataFrame) – A dataframe with all the tweets of a user, and their sentiment analysis.

Returns:

plot – A matplotlib plot of the wordcloud.

Return type:

plt.figure()

Examples

create_wordcloud(df)