<jupyter_start><jupyter_text>CommandsDo female characters to use fewer commands than male characters? Does this depend on their role in the story? And do the TYPES of commands they use differ?Below, I use regular expressions to capture 3 types of commands:* Imperative Forms (ex: Stay here!)* Modal Forms (ex: You must stay.)* Suggestions (ex: You should stay.)The lasts one, suggestion, isn't quite a command, but if we assume that female speech tends to be collaborative and noncombative, female speakers may lean more toward suggestion than male characters do. Table of Contents1. [Finding Commands](fc)2. [Visualizations](viz)    1. [Gender](g)    2. [Role](r)    3. [Role and Gender](rg)3. [Siginificance Tests](sig)    1. [Gender](sigg)    2. [Role](sigr)    3. [Role and Gender](siggr)<jupyter_code>import pandas as pd
import re
from matplotlib import pyplot as plt
from scipy import stats
movies_df = pd.read_pickle(r"C:/Users/cassi/Desktop/Data_Science/Animated-Movie-Gendered-Dialogue/private/all_tagged_dialogue.pkl")
movies_df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 13442 entries, 0 to 13441
Data columns (total 18 columns):
Disney_Period       13442 non-null object
Gender              13442 non-null object
Movie               13442 non-null object
Role                13442 non-null object
Song                13442 non-null object
Speaker             13442 non-null object
Speaker_Status      13442 non-null object
Text                13442 non-null object
UTTERANCE_NUMBER    13442 non-null int64
Year                13442 non-null int64
Tokens              13442 non-null object
Types               13442 non-null object
Token_Count         13442 non-null int64
Type_Count          13442 non-null int64
POS                 13442 non-null object
Tag_Freq            13442 non-null object
Adj_Count           13442 non-null int64
Adj_over_Tokens     13442 non-null float64
dtypes: float64(1), int64(5), object(12)
memory usage: 1.2+ MB<jupyter_text>Finding Commands 1. ImperativesThe following function is based on the idea that commands come at the beginning of a sentence, and imperative commands are in the verb's base form ('VB' in my POS tags). So, first it checks if the first word is a base form verb, then it goes through the line and checks for a 'VB' after punctuation or a conjunction (so if someone says somethine like "Clean this up and do your homework", both commands will be captured).<jupyter_code>def find_commands(tagged_sent):
    commands_count = 0
    if tagged_sent[0][1] == 'VB':
        commands_count += 1
    for x in tagged_sent[1:]:
        if x[1] == 'VB':
            place = tagged_sent.index(x)
            if tagged_sent[place-1][1] == "." or tagged_sent[place-1][1] == "," or tagged_sent[place-1][1] == 'CC':
                commands_count += 1
    return commands_count
movies_df["Imp_Command_Count"] = movies_df.POS.map(find_commands)
movies_df.Imp_Command_Count.describe() #most lines aren't commmands at all!
movies_df[movies_df.Imp_Command_Count >=1].shape<jupyter_output><empty_output><jupyter_text>2. Modal CommandsHere, I look for modals addressed toward the second person. I exclude stuff like "You've gotta be kidding me".<jupyter_code>def find_modal_commands(sent):
    m_commands_1 = re.findall(r"you( must| got to|'ve got to| gotta|'ve gotta)(?! be )", sent)
    m_commands_2 = re.findall(r"you (shall|will|have to|ought|need to|may not|can't|cannot|won't)", sent)
    m_commands_count = len(m_commands_1) + len(m_commands_2)
    return m_commands_count
movies_df['Modal_Command_Count'] = movies_df.Text.map(find_modal_commands)
movies_df['Modal_Command_Count'].describe() #not many....
movies_df[movies_df.Modal_Command_Count >=1].shape<jupyter_output><empty_output><jupyter_text>3. SuggestionsHere, I look for modals that imply suggestion. Notice how "you can come over" is more suggestive than "you can't come over", which sounds more like a blatant command.<jupyter_code>def find_suggestion(sent):
    sug_1 = re.findall(r'you may (?!be )', sent)
    sug_2 = re.findall(r'you (should|could|better|can )', sent)
    sug_count = len(sug_1) + len(sug_2)
    return sug_count
movies_df['Suggestion_Count'] = movies_df.Text.map(find_suggestion)
movies_df.Suggestion_Count.describe() #again, not many...
movies_df[movies_df.Suggestion_Count >=1].shape<jupyter_output><empty_output><jupyter_text>Overall, modal commands and suggestions are much less frequent than imperative commands. So, how do they compare?  4. Summing Them All UpLet's add all these values to get a cumulative command count!<jupyter_code>movies_df['Total_Command_Count'] = movies_df.Imp_Command_Count + movies_df.Modal_Command_Count + movies_df.Suggestion_Count
movies_df.Total_Command_Count.describe()
movies_df[movies_df.Total_Command_Count == 12].iloc[0].Text<jupyter_output><empty_output><jupyter_text>Visualizations Gender<jupyter_code>movies_gen_df = movies_df[movies_df.Gender != 'n']
imp_command_by_gen = movies_gen_df.groupby('Gender')['Imp_Command_Count'].describe()['mean']
imp_command_by_gen.plot.bar(color=['magenta', 'blue'])
plt.title('Avg Imperative Commands per Line by Gender')
plt.ylabel('Command Count')
mod_command_by_gen = movies_gen_df.groupby('Gender')['Modal_Command_Count'].describe()['mean']
mod_command_by_gen.plot.bar(color=['magenta', 'blue'])
plt.title('Avg Modal Commands per Line by Gender')
plt.ylabel('Command Count')
sug_by_gen = movies_gen_df.groupby('Gender')['Suggestion_Count'].describe()['mean']
sug_by_gen.plot.bar(color=['magenta', 'blue'])
plt.title('Avg Suggestions per Line by Gender')
plt.ylabel('Suggestion Count')<jupyter_output><empty_output><jupyter_text>It looks like males use more imperatives, while females are more inclined to use modals or suggestion!<jupyter_code>com_by_gen = movies_gen_df.groupby('Gender')['Total_Command_Count'].describe()['mean']
com_by_gen.plot.bar(color=['magenta', 'blue'])
plt.title('Avg Commands per Line by Gender')
plt.ylabel('Command Count')
imp_com_by_gen_era = movies_gen_df.groupby(['Disney_Period','Gender'], sort=False)['Imp_Command_Count'].describe()['mean']
imp_com_by_gen_era.unstack().plot.bar(color=['magenta', 'blue'], figsize=(15,6))
plt.xlabel('Era')
plt.ylabel('Command Count')
plt.title('Avg Imperative Command Counts Over Time by Gender')<jupyter_output><empty_output><jupyter_text>Males consistently have more imperative commands in each era.<jupyter_code>mod_com_by_gen_era = movies_gen_df.groupby(['Disney_Period','Gender'], sort=False)['Modal_Command_Count'].describe()['mean']
mod_com_by_gen_era.unstack().plot.bar(color=['magenta', 'blue'], figsize=(15,6))
plt.xlabel('Era')
plt.ylabel('Command Count')
plt.title('Avg Modal Command Counts Over Time by Gender')<jupyter_output><empty_output><jupyter_text>In every era (save dreamworks), females use more modal commands than males, and both genders have increased their modal command count<jupyter_code>sug_by_gen_era = movies_gen_df.groupby(['Disney_Period','Gender'], sort=False)['Suggestion_Count'].describe()['mean']
sug_by_gen_era.unstack().plot.bar(color=['magenta', 'blue'], figsize=(15,6))
plt.xlabel('Era')
plt.ylabel('Suggestion Count')
plt.title('Avg Suggestion Counts Over Time by Gender')<jupyter_output><empty_output><jupyter_text>No male characters make suggestions in the early period! This may be a reflection of my regular expressions...<jupyter_code>com_by_gen_era = movies_gen_df.groupby(['Disney_Period','Gender'], sort=False)['Total_Command_Count'].describe()['mean']
com_by_gen_era.unstack().plot.bar(color=['magenta', 'blue'], figsize=(15,6))
plt.xlabel('Era')
plt.ylabel('Command Count')
plt.title('Avg Total Command Counts Over Time by Gender')<jupyter_output><empty_output><jupyter_text>Role<jupyter_code>movies_role_df = movies_df[movies_df.Role != 'N']
imp_command_by_role = movies_role_df.groupby('Role')['Imp_Command_Count'].describe()['mean']
imp_command_by_role.plot.bar(color=['red', 'purple', 'blue'])
plt.title('Avg Imperative Commands per Line by Role')
plt.ylabel('Command Count')
mod_command_by_role = movies_role_df.groupby('Role')['Modal_Command_Count'].describe()['mean']
mod_command_by_role.plot.bar(color=['red', 'purple', 'blue'])
plt.title('Avg Modal Commands per Line by Role')
plt.ylabel('Command Count')
sug_by_role = movies_role_df.groupby('Role')['Suggestion_Count'].describe()['mean']
sug_by_role.plot.bar(color=['red', 'purple', 'blue'])
plt.title('Avg Suggestions per Line by Role')
plt.ylabel('Suggestion Count')<jupyter_output><empty_output><jupyter_text>Antagonists seem to make more suggestions and commands!<jupyter_code>com_by_role = movies_role_df.groupby('Role')['Total_Command_Count'].describe()['mean']
com_by_role.plot.bar(color=['red', 'purple', 'blue'])
plt.title('Avg Total Commands per Line by Role')
plt.ylabel('Command Count')
imp_com_by_role_era = movies_role_df.groupby(['Disney_Period','Role'], sort=False)['Imp_Command_Count'].describe()['mean']
imp_com_by_role_era.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Imperative Command Counts over Time by Role')
plt.xlabel('Era')
plt.ylabel('Command Count')<jupyter_output><empty_output><jupyter_text>This is pretty mixed...<jupyter_code>mod_com_by_role_era = movies_role_df.groupby(['Disney_Period','Role'], sort=False)['Modal_Command_Count'].describe()['mean']
mod_com_by_role_era.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Modal Command Counts over Time by Role')
plt.xlabel('Era')
plt.ylabel('Command Count')<jupyter_output><empty_output><jupyter_text>As time goes on, both protagonists and antagonists tend to use more modal commands<jupyter_code>sug_by_role_era = movies_role_df.groupby(['Disney_Period','Role'], sort=False)['Suggestion_Count'].describe()['mean']
sug_by_role_era.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Suggestion Counts over Time by Role')
plt.xlabel('Era')
plt.ylabel('Suggestion Count')<jupyter_output><empty_output><jupyter_text>In each era, antagonists are making more suggestions--perhaps as a form of trickery? Protagonists have also increased suggestion counts over time<jupyter_code>com_by_role_era = movies_role_df.groupby(['Disney_Period','Role'], sort=False)['Total_Command_Count'].describe()['mean']
com_by_role_era.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Total Command Counts over Time by Role')
plt.xlabel('Era')
plt.ylabel('Command Count')<jupyter_output><empty_output><jupyter_text>Role and Gender<jupyter_code>movies_role_gen_df = movies_df[(movies_df.Gender != 'n') & (movies_df.Role != 'N')]
imp_com_gen_role = movies_role_gen_df.groupby(['Gender','Role'], sort=False)['Imp_Command_Count'].describe()['mean']
imp_com_gen_role.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Imperative Commmand Counts by Gender & Role')
plt.xlabel('Gender')
plt.ylabel('Command Count')
plt.savefig(r'C:\Users\cassi\Desktop\Data_Science\Animated-Movie-Gendered-Dialogue\images\imp_command_gen_role.png')<jupyter_output><empty_output><jupyter_text>Female antagonists use more commands than female protagonists and male antagonists. Male protagonists only use slightly more commands than female protagonists.<jupyter_code>mod_com_gen_role = movies_role_gen_df.groupby(['Gender','Role'], sort=False)['Modal_Command_Count'].describe()['mean']
mod_com_gen_role.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Modal Commmand Counts by Gender & Role')
plt.xlabel('Gender')
plt.ylabel('Command Count')
plt.savefig(r"C:\Users\cassi\Desktop\Data_Science\Animated-Movie-Gendered-Dialogue\images\mod_command_gen_role.png")<jupyter_output><empty_output><jupyter_text>Female protagonists use more modal commands than male protagonists and female antagonists!<jupyter_code>sug_gen_role = movies_role_gen_df.groupby(['Gender','Role'], sort=False)['Suggestion_Count'].describe()['mean']
sug_gen_role.unstack().plot.bar(color=['red', 'blue', 'purple'], figsize=(15,6))
plt.title('Avg Suggestion Counts by Gender & Role')
plt.xlabel('Gender')
plt.ylabel('Suggestion Count')<jupyter_output><empty_output><jupyter_text>Wow, nearly no differences between female pros and ants or male pros and female pros. But male antagonists tend to use them.  Significance Tests<jupyter_code>#Gender overall
f_movies = movies_df[movies_df.Gender == 'f']
m_movies = movies_df[movies_df.Gender == 'm']

#Gender over time
f_movies_early = f_movies[f_movies.Disney_Period == 'EARLY']
m_movies_early = m_movies[m_movies.Disney_Period == 'EARLY']

f_movies_mid = f_movies[f_movies.Disney_Period == 'MID']
m_movies_mid = m_movies[m_movies.Disney_Period == 'MID']

f_movies_late = f_movies[f_movies.Disney_Period == 'LATE']
m_movies_late = m_movies[m_movies.Disney_Period == 'LATE']

#Gender Across Companies
f_movies_disney = f_movies[f_movies.Disney_Period != 'DREAMWORKS']
f_movies_dw = f_movies[f_movies.Disney_Period == 'DREAMWORKS']

m_movies_disney = m_movies[m_movies.Disney_Period != 'DREAMWORKS']
m_movies_dw = m_movies[m_movies.Disney_Period == 'DREAMWORKS']

#Role Overall
pro_movies = movies_df[movies_df.Role == 'PRO']
ant_movies = movies_df[movies_df.Role == 'ANT']
helper_movies = movies_df[movies_df.Role == 'HELPER']

#Role Over Time
pro_movies_early = pro_movies[pro_movies.Disney_Period == 'EARLY']
pro_movies_mid = pro_movies[pro_movies.Disney_Period == 'MID']
pro_movies_late = pro_movies[pro_movies.Disney_Period == 'LATE']

ant_movies_early = ant_movies[ant_movies.Disney_Period == 'EARLY']
ant_movies_mid = ant_movies[ant_movies.Disney_Period == 'MID']
ant_movies_late = ant_movies[ant_movies.Disney_Period == 'LATE']

#Role by Company
ant_movies_disney = ant_movies[ant_movies.Disney_Period != 'DREAMWORKS']
ant_movies_dw = ant_movies[ant_movies.Disney_Period == 'DREAMWORKS']

pro_movies_disney = pro_movies[pro_movies.Disney_Period != 'DREAMWORKS']
pro_movies_dw = pro_movies[pro_movies.Disney_Period == 'DREAMWORKS']

#Role and Gender
movies_gen_role = movies_df[(movies_df.Gender != 'n') & (movies_df.Role != 'N')]

pro_f_movies = movies_gen_role[(movies_gen_role.Gender == 'f') & (movies_gen_role.Role == 'PRO')]
pro_m_movies = movies_gen_role[(movies_gen_role.Gender == 'm') & (movies_gen_role.Role == 'PRO')]

ant_f_movies = movies_gen_role[(movies_gen_role.Gender == 'f') & (movies_gen_role.Role == 'ANT')]
ant_m_movies = movies_gen_role[(movies_gen_role.Gender == 'm') & (movies_gen_role.Role == 'ANT')]<jupyter_output><empty_output><jupyter_text>Gender Gender Overall<jupyter_code>print('Overall Gender Differences (Male vs Female)')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print(stats.ttest_ind(m_movies[x], f_movies[x], equal_var=False))
    print('\n')<jupyter_output>Overall Gender Differences (Male vs Female)
Imp_Command_Count
Ttest_indResult(statistic=2.659776627954855, pvalue=0.007833837143633273)


Modal_Command_Count
Ttest_indResult(statistic=-0.7551096511463004, pvalue=0.4502058802815313)


Suggestion_Count
Ttest_indResult(statistic=-0.21147132614904182, pvalue=0.8325248644262484)


Total_Command_Count
Ttest_indResult(statistic=2.168885120953673, pvalue=0.03011967418309977)<jupyter_text>Male characters use significantly more imperative commands, and overall use significantly more commands!  Gender Over Time<jupyter_code>print('Gender Differences over Time')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('Female')
    print('ANOVA')
    print(stats.f_oneway(f_movies_early[x], f_movies_mid[x], f_movies_late[x]))
    print('EARLY V MID')
    print(stats.ttest_ind(f_movies_early[x], f_movies_mid[x], equal_var=False))
    print('EARLY V LATE')
    print(stats.ttest_ind(f_movies_early[x], f_movies_late[x], equal_var=False))
    print('MID V LATE')
    print(stats.ttest_ind(f_movies_mid[x], f_movies_late[x], equal_var=False))
    print('\nMale')
    print('ANOVA')
    print(stats.f_oneway(m_movies_early[x], m_movies_mid[x], m_movies_late[x]))
    print('EARLY V MID')
    print(stats.ttest_ind(m_movies_early[x], m_movies_mid[x], equal_var=False))
    print('EARLY V LATE')
    print(stats.ttest_ind(m_movies_early[x], m_movies_late[x], equal_var=False))
    print('MID V LATE')
    print(stats.ttest_ind(m_movies_mid[x], m_movies_late[x], equal_var=False))
    print('\n')
print('Gender Differences w/in Each Era (M v F)')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('EARLY')
    print(stats.ttest_ind(m_movies_early[x], f_movies_early[x], equal_var=False))
    print('MID')
    print(stats.ttest_ind(m_movies_mid[x], f_movies_mid[x], equal_var=False))
    print('LATE')
    print(stats.ttest_ind(m_movies_late[x], f_movies_late[x], equal_var=False))
    print('\n')<jupyter_output>Gender Differences w/in Each Era (M v F)
Imp_Command_Count
EARLY
Ttest_indResult(statistic=1.1824477999601386, pvalue=0.2373008733205311)
MID
Ttest_indResult(statistic=4.2673199582663095, pvalue=2.0813593295663377e-05)
LATE
Ttest_indResult(statistic=1.2768584324593766, pvalue=0.2017671248574724)


Modal_Command_Count
EARLY
Ttest_indResult(statistic=-1.1226275492974946, pvalue=0.26181701799177354)
MID
Ttest_indResult(statistic=-0.0808050192999737, pvalue=0.9356074478133607)
LATE
Ttest_indResult(statistic=-0.14847095063452137, pvalue=0.8819825826813525)


Suggestion_Count
EARLY
Ttest_indResult(statistic=-2.657163663003932, pvalue=0.008059808199985991)
MID
Ttest_indResult(statistic=-0.28845501921600103, pvalue=0.7730435806940852)
LATE
Ttest_indResult(statistic=0.3178041599284992, pvalue=0.7506594035271016)


Total_Command_Count
EARLY
Ttest_indResult(statistic=0.6624075817464954, pvalue=0.5078528235352169)
MID
Ttest_indResult(statistic=3.7074927019000046, pvalue=0.00021588452308422788)
LAT[...]<jupyter_text>Gender Across Companies<jupyter_code>print('Gender Differences Across Companies')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('M v F: DISNEY')
    print(stats.ttest_ind(m_movies_disney[x], f_movies_disney[x], equal_var=False))
    print('M v F: DREAMWORKS')
    print(stats.ttest_ind(m_movies_dw[x], f_movies_dw[x], equal_var=False))
    print('Disney v Dreamworks: M')
    print(stats.ttest_ind(m_movies_disney[x], m_movies_dw[x], equal_var=False))
    print('Disney v Dreamworks: F')
    print(stats.ttest_ind(f_movies_disney[x], f_movies_dw[x], equal_var=False))
    print('\n')<jupyter_output>Gender Differences Across Companies
Imp_Command_Count
M v F: DISNEY
Ttest_indResult(statistic=2.538852499553593, pvalue=0.011145435964832725)
M v F: DREAMWORKS
Ttest_indResult(statistic=4.063189998417468, pvalue=4.988722404684792e-05)
Disney v Dreamworks: M
Ttest_indResult(statistic=4.879315773288723, pvalue=1.0865496345531275e-06)
Disney v Dreamworks: F
Ttest_indResult(statistic=4.911616883812411, pvalue=9.445829517853623e-07)


Modal_Command_Count
M v F: DISNEY
Ttest_indResult(statistic=-0.4968769182630477, pvalue=0.6192936131911158)
M v F: DREAMWORKS
Ttest_indResult(statistic=0.8165049829664607, pvalue=0.4142971834618523)
Disney v Dreamworks: M
Ttest_indResult(statistic=1.954702820790155, pvalue=0.05065815328784088)
Disney v Dreamworks: F
Ttest_indResult(statistic=2.546290585174702, pvalue=0.010928348305454007)


Suggestion_Count
M v F: DISNEY
Ttest_indResult(statistic=-0.5741325960763118, pvalue=0.5658997209483554)
M v F: DREAMWORKS
Ttest_indResult(statistic=0.6038839611723288, pva[...]<jupyter_text>Role Role Overall<jupyter_code>print('Overall Role Differences (Pro vs Ant)')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print(stats.ttest_ind(pro_movies[x], ant_movies[x], equal_var=False))
    print('\n')<jupyter_output>Overall Role Differences (Pro vs Ant)
Imp_Command_Count
Ttest_indResult(statistic=-2.5431922598497247, pvalue=0.01102680650394242)


Modal_Command_Count
Ttest_indResult(statistic=-1.4989521569558875, pvalue=0.13398281572648457)


Suggestion_Count
Ttest_indResult(statistic=-0.9151634547975789, pvalue=0.36017219737193973)


Total_Command_Count
Ttest_indResult(statistic=-2.945848615521399, pvalue=0.0032414921126683663)<jupyter_text>Role Over Time<jupyter_code>print('Role Differences over Time')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('Pro')
    print('ANOVA')
    print(stats.f_oneway(pro_movies_early[x], pro_movies_mid[x], pro_movies_late[x]))
    print('EARLY V MID')
    print(stats.ttest_ind(pro_movies_early[x], pro_movies_mid[x], equal_var=False))
    print('EARLY V LATE')
    print(stats.ttest_ind(pro_movies_early[x], pro_movies_late[x], equal_var=False))
    print('MID V LATE')
    print(stats.ttest_ind(pro_movies_mid[x], pro_movies_late[x], equal_var=False))
    print('\nAnt')
    print('ANOVA')
    print(stats.f_oneway(ant_movies_early[x], ant_movies_mid[x], ant_movies_late[x]))
    print('EARLY V MID')
    print(stats.ttest_ind(ant_movies_early[x], ant_movies_mid[x], equal_var=False))
    print('EARLY V LATE')
    print(stats.ttest_ind(ant_movies_early[x], ant_movies_late[x], equal_var=False))
    print('MID V LATE')
    print(stats.ttest_ind(ant_movies_mid[x], ant_movies_late[x], equal_var=False))
    print('\n')
print('Role Differences w/in Each Era (Pro v Ant)')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('EARLY')
    print(stats.ttest_ind(pro_movies_early[x], ant_movies_early[x], equal_var=False))
    print('MID')
    print(stats.ttest_ind(pro_movies_mid[x], ant_movies_mid[x], equal_var=False))
    print('LATE')
    print(stats.ttest_ind(pro_movies_late[x], ant_movies_late[x], equal_var=False))
    print('\n')<jupyter_output>Role Differences w/in Each Era (Pro v Ant)
Imp_Command_Count
EARLY
Ttest_indResult(statistic=-0.03993935867198671, pvalue=0.9681586079767261)
MID
Ttest_indResult(statistic=-0.8656581835824684, pvalue=0.3868942896044665)
LATE
Ttest_indResult(statistic=0.6733678058917931, pvalue=0.5009148658184166)


Modal_Command_Count
EARLY
Ttest_indResult(statistic=0.46142859020158056, pvalue=0.6447575126976508)
MID
Ttest_indResult(statistic=-1.556522977236283, pvalue=0.11998802009210013)
LATE
Ttest_indResult(statistic=-0.19700214274129563, pvalue=0.8438910830299138)


Suggestion_Count
EARLY
Ttest_indResult(statistic=-0.9915384503418707, pvalue=0.3220921763082948)
MID
Ttest_indResult(statistic=-0.5974736461433966, pvalue=0.5503374576804048)
LATE
Ttest_indResult(statistic=-0.5265268277400478, pvalue=0.5987284817391306)


Total_Command_Count
EARLY
Ttest_indResult(statistic=-0.0982961361339693, pvalue=0.9217394123166054)
MID
Ttest_indResult(statistic=-1.3887864025121297, pvalue=0.16522519952731377)
LATE
[...]<jupyter_text>Role Across Companies<jupyter_code>print('Role Differences Across Companies')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('Pro v Ant: DISNEY')
    print(stats.ttest_ind(pro_movies_disney[x], ant_movies_disney[x], equal_var=False))
    print('Pro v Ant: DREAMWORKS')
    print(stats.ttest_ind(pro_movies_dw[x], ant_movies_dw[x], equal_var=False))
    print('Disney v Dreamworks: Pro')
    print(stats.ttest_ind(pro_movies_disney[x], pro_movies_dw[x], equal_var=False))
    print('Disney v Dreamworks: Ant')
    print(stats.ttest_ind(ant_movies_disney[x], ant_movies_dw[x], equal_var=False))
    print('\n')<jupyter_output>Role Differences Across Companies
Imp_Command_Count
Pro v Ant: DISNEY
Ttest_indResult(statistic=-0.44285834602333196, pvalue=0.6579109844751362)
Pro v Ant: DREAMWORKS
Ttest_indResult(statistic=-3.1806544110507726, pvalue=0.0015030819840995834)
Disney v Dreamworks: Pro
Ttest_indResult(statistic=3.812762922685316, pvalue=0.00013886817125913597)
Disney v Dreamworks: Ant
Ttest_indResult(statistic=-0.17210803989584375, pvalue=0.8633711941968377)


Modal_Command_Count
Pro v Ant: DISNEY
Ttest_indResult(statistic=-0.619587012399368, pvalue=0.5355994355975828)
Pro v Ant: DREAMWORKS
Ttest_indResult(statistic=-1.5575313381473512, pvalue=0.11959890354413923)
Disney v Dreamworks: Pro
Ttest_indResult(statistic=3.0604963530782086, pvalue=0.002220917845462288)
Disney v Dreamworks: Ant
Ttest_indResult(statistic=1.0034423890985291, pvalue=0.3157670687927239)


Suggestion_Count
Pro v Ant: DISNEY
Ttest_indResult(statistic=-0.6662015131893593, pvalue=0.5053621879657855)
Pro v Ant: DREAMWORKS
Ttest_indResul[...]<jupyter_text>Gender and Role<jupyter_code>print('Role and Gender Differences')
for x in ['Imp_Command_Count', 'Modal_Command_Count', 'Suggestion_Count', 'Total_Command_Count']:
    print(x)
    print('Female PRO v Male PRO')
    print(stats.ttest_ind(pro_f_movies[x], pro_m_movies[x], equal_var=False))
    print('Female ANT v Male ANT')
    print(stats.ttest_ind(ant_f_movies[x], ant_m_movies[x], equal_var=False))
    print('Female PRO v Female ANT')
    print(stats.ttest_ind(pro_f_movies[x], ant_f_movies[x], equal_var=False))
    print('Male PRO v Male ANT')
    print(stats.ttest_ind(pro_m_movies[x], ant_m_movies[x], equal_var=False))
    print('\n')<jupyter_output>Role and Gender Differences
Imp_Command_Count
Female PRO v Male PRO
Ttest_indResult(statistic=-1.4365061373196406, pvalue=0.15091832551591916)
Female ANT v Male ANT
Ttest_indResult(statistic=1.0519433779315956, pvalue=0.2931792856214876)
Female PRO v Female ANT
Ttest_indResult(statistic=-2.5446015319188207, pvalue=0.011181019758248902)
Male PRO v Male ANT
Ttest_indResult(statistic=-1.2184887263469861, pvalue=0.223131993238681)


Modal_Command_Count
Female PRO v Male PRO
Ttest_indResult(statistic=2.1641255445274745, pvalue=0.030510853632501847)
Female ANT v Male ANT
Ttest_indResult(statistic=-0.5111963889040982, pvalue=0.6093518652374705)
Female PRO v Female ANT
Ttest_indResult(statistic=0.279298599279462, pvalue=0.7800982302531387)
Male PRO v Male ANT
Ttest_indResult(statistic=-2.288814095726704, pvalue=0.022175506889531935)


Suggestion_Count
Female PRO v Male PRO
Ttest_indResult(statistic=0.04096317998494099, pvalue=0.9673268331321608)
Female ANT v Male ANT
Ttest_indResult(statistic=[...]
{'fraction_non_alphanumeric': 0.12622353744593673, 'fraction_numerical': 0.08320054632369679, 'mean_word_length': 7.397260273972603, 'pattern_counts': {'":': 0, '<': 98, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '26', 'dir': 'jupyter-structured-clean-dedup', 'id': '93072', 'license': 'RSA-MD', 'n_tokens_mistral': 11328, 'n_tokens_neox': 9797, 'n_words': 1742, 'path': 'code/Analysis_code/Commands_Analysis.ipynb', 'repo_name': 'Data-Science-for-Linguists-2019/Animated-Movie-Gendered-Dialogue', 'size': '26358'}