<jupyter_start><jupyter_text>[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Piphi5/Adopt-a-Pixel3km-Notebooks/blob/main/CEO%20Project%20Generation/CEO%20File%20Generator.ipynb)  Setup<jupyter_code>import os

import pandas as pd<jupyter_output><empty_output><jupyter_text>Specify Directories- `input_directory`: The name of the directory containing the files that will be read- `output_directory`: The name of the directory that will contain the generated files<jupyter_code>input_directory = "Sample AOI"
output_directory = "Sample CEO Project Files"
files = [file for file in os.listdir(input_directory) if file.endswith(".csv")]
files
points_df = pd.DataFrame()
aoi_df = pd.DataFrame()
for i, filename in enumerate(files):
    name = filename.split("_")[0]
    aoi = pd.DataFrame()

    grid = pd.read_csv(f"{input_directory}/{filename}")
    try:
        plot_id = [j + 100 * i for j in range(37)]
        grid["PLOTID"] = plot_id
        aoi["PLOTID"] = plot_id
        aoi["Name"] = name
    except ValueError:
        print(f"{filename} failed")
        continue
    points_df = points_df.append(grid, ignore_index=True)
    aoi_df = aoi_df.append(aoi, ignore_index=True)

# Convert into CEO Format
points = points_df[["PLOTID", "Longitude", "Latitude"]]
points = points.fillna(0.0)
points.rename({"Latitude": "LAT", "Longitude": "LON"}, inplace=True, axis=1)<jupyter_output><empty_output><jupyter_text>Display Table PreviewDisplays the tables for the CEO file and the Plot assignment file<jupyter_code>points
aoi_df<jupyter_output><empty_output><jupyter_text>Output FilesRun this cell to create the following files:- `CEO Points.csv`: The file that is supposed to be uploaded to CollectEarthOnline- `Plot Assignments.csv`: A CSV file containing the CEO plot ids along with the person who should identify them<jupyter_code>if not os.path.exists(output_directory):
    os.makedirs(output_directory)

points.to_csv(f"{output_directory}/CEO Points.csv", index=False)
aoi_df.to_csv(f"{output_directory}/Plot Assignments.csv", index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1200373657169547, 'fraction_numerical': 0.008874357776739842, 'mean_word_length': 5.5504587155963305, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '389468', 'license': 'MIT', 'n_tokens_mistral': 743, 'n_tokens_neox': 714, 'n_words': 169, 'path': 'CEO Project Generation/CEO File Generator.ipynb', 'repo_name': 'Piphi5/Adopt-a-Pixel3km-Notebooks', 'size': '2141'}