<jupyter_start><jupyter_text>This notebook collects all of the tweets for a given team, imports them into a dataframe, adds a team classification tag, and dumps to a csv.<jupyter_code>#bring in the prerequisites

import pandas as pd
import glob
import json
import numpy as np
import pandas as pd
# identify the folder where the files are -- this will be done once per team, aligning the team folder name to the column we will create
files = glob.glob('raw_tweets/pride_phillies/*')
#files = glob.glob('user/*')
len(files)
#make a list to hold the files we are going to read
#then read the files into a dictionary

dictlist = []

for file in files:
    json_string = open(file, 'r').read()
    json_dict = json.loads(json_string)
    dictlist.append(json_dict)
#create a dataframe from the dictionary
df = pd.DataFrame(dictlist)
df.head()
#create the new column and give all rows the same value-- this is how we will keep track of the team names
df['team'] = "phillies"
df.head()
#dump it to a csv so we can use it later

df.to_csv('basic_csv/phillies_tweets.csv', index=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0832579185520362, 'fraction_numerical': 0.0, 'mean_word_length': 4.614213197969543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '488812', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 352, 'n_tokens_neox': 342, 'n_words': 152, 'path': 'BasicDataClean.ipynb', 'repo_name': 'dcpatti/ThePrideProject', 'size': '1105'}