<jupyter_start><jupyter_text>finding unique usernames<jupyter_code>df.user_screen_name.value_counts()
c2=df.in_reply_to_screen_name.value_counts()
c3=df.retweet_or_quote_screen_name.value_counts()
pd.unique(df.in_reply_to_screen_name)
s1=pd.DataFrame(c2)
s2=pd.DataFrame(c3)
s2
s1.to_csv('reply_username_list.csv', index=True)
s2.to_csv('retweet_username_list.csv', index=True)
s1.index

s3 = s1[s1.index.isin(s2.index)]
s3<jupyter_output><empty_output><jupyter_text>adding types I = InstituitionOI = Other InstituitionsP = Person/IndividualNo Account = Account deleted  in reply usernames<jupyter_code># in_reply_to_screen_name
filepath = os.path.join(
    "\\".join([os.getcwd(), "reply_username_list.csv"]) 
)
df_s1 = pd.read_csv(filepath, index_col=False)
df_s1.rename(columns={"Unnamed: 0":"username"},inplace=True)
df_s1.head()
# df_s1[df_s1['username'].str.contains("TAMU")]<jupyter_output><empty_output><jupyter_text>TAMU AGGIE _ & numbers<jupyter_code>df_s1['type'] = df_s1.username.map(lambda x: 'I' if x.lower().__contains__("tamu") else 'I' if x.lower().__contains__("aggie") else 'P' if x.__contains__("_") else 'P' if any(chr.isdigit() for chr in x) else np.nan)
df_s1

df_s1=df_s1.sort_values(by=['type'])
df_s1.reset_index(drop=True)<jupyter_output><empty_output><jupyter_text>retweet usernames<jupyter_code># retweet_or_quote_screen_name
filepath = os.path.join(
    "\\".join([os.getcwd(), "retweet_username_list.csv"]) 
)
df_s2 = pd.read_csv(filepath, index_col=False)
df_s2.rename(columns={"Unnamed: 0":"username"},inplace=True)
df_s2.head()<jupyter_output><empty_output><jupyter_text>TAMU AGGIE _ & numbers<jupyter_code># df_s2['type'] = df_s2.username.map(lambda x: 'I' if x.lower().__contains__("tamu") else 'I' if x.lower().__contains__("aggie") else 'P' if x.__contains__("_") else 'P' if any(chr.isdigit() for chr in x) else np.nan)
df_s2['type'] = df_s2.username.map(lambda x: 'I' if x.lower().__contains__("tamu") else 'I' if x.lower().__contains__("aggie") else 'P' if x.__contains__(
    "_") else 'P' if any(chr.isdigit() for chr in x) else 'OI' if x.lower().__contains__("texas") else 'OI' if x.lower().__contains__("school") else 'OI' if x.lower().__contains__("tx") else 'OI' if x.lower().__contains__("news") else 'OI' if x.isupper() else np.nan)<jupyter_output><empty_output><jupyter_text>numbers & _<jupyter_code>df_s2
df_s2=df_s2.sort_values(by=['type'])
df_s2.reset_index(drop=True)<jupyter_output><empty_output><jupyter_text>saving data<jupyter_code># df_s1.to_csv('reply_username_list.csv', index=True)
# df_s2.to_csv('retweet_username_list.csv', index=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1692658805629517, 'fraction_numerical': 0.015595283377710156, 'mean_word_length': 8.293286219081272, 'pattern_counts': {'":': 2, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '611356', 'license': 'MIT', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1109, 'n_words': 159, 'path': 'analysis.ipynb', 'repo_name': 'gwu-libraries/dei_highered_twitter', 'size': '2629'}