<jupyter_start><jupyter_text>Creating 2 Tables: Sites for Map, SiteSpecific for Table  General Approach:asdf Files Needed1) dontopen_SiteLJSSA.csv, 2) dontopen_SSALJSite.csv  Sites LJ SSA, for creating Site Points, Popups and Legend Colors on Map Only<jupyter_code>#Needed Libaraies
import os
import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 999)  # How to display all columns of a Pandas DataFrame in Jupyter Notebook

#Setting work directory, reading inputs, creating dataframe
workingDir = "C:/Users/rjame/Documents/WSWC Documents/Portal Creation Research"
os.chdir(workingDir)
#Sites LeftJoin SSA Input
SiteLFSSAfileInput = "dontopen_SiteLJSSA.csv"
dfsite = pd.read_csv(SiteLFSSAfileInput)
dfsite.head
#Removing Null value rows
dfsite = dfsite[dfsite['ReportYearCV'].notna()]
dfsite.reset_index()
dfsite
dfsite.head(3)
#check columns & datatype
with pd.option_context('display.max_rows', None, 'display.max_columns', None):
    print(dfsite.dtypes)
## Create Sites Dataframe - with attached Allo and Benuse info ##
########################################
outdfSite = pd.DataFrame()

#The Columns
outdfSite['SiteUUID'] = dfsite['SiteUUID'].astype(str)
outdfSite['SiteNativeID'] = dfsite['SiteNativeID'].astype(str)
outdfSite['SiteName'] = dfsite['SiteName'].astype(str)
outdfSite['SiteTypeCV'] = dfsite['SiteTypeCV'].astype(str)
outdfSite['County'] = dfsite['County'].astype(str)
outdfSite['WaterSourceName'] = dfsite['WaterSourceName'].astype(str)
outdfSite['WaterSourceTypeCV'] = dfsite['WaterSourceTypeCV'].astype(str)
outdfSite['WaterSourceNativeID'] = dfsite['WaterSourceNativeID'].astype(str)
outdfSite['Latitude'] = dfsite['Latitude'].astype(float) 
outdfSite['Longitude'] = dfsite['Longitude'].astype(float)


#Drop Duplicates - SiteUUID
outdfSite = outdfSite.drop_duplicates(['SiteUUID'], keep="first").reset_index(drop=True)

outdfSite
#Exporting Outbound DataFrame to working csv file.
outdfSite.to_csv('P_SiteLJSSA.csv', index=False)  # The output<jupyter_output><empty_output><jupyter_text>SSA LF Site, for filtering and Table Return Only<jupyter_code>#Needed Libaraies
import os
import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 999)  # How to display all columns of a Pandas DataFrame in Jupyter Notebook

#Setting work directory, reading inputs, creating dataframe
workingDir = "C:/Users/rjame/Documents/WSWC Documents/Portal Creation Research"
os.chdir(workingDir)
#Allo LeftJoin Sites Input
AllofileInput = "dontopen_SSALJSite.csv"
dfssa = pd.read_csv(AllofileInput)
dfssa.head(3)
#check columns & datatype
with pd.option_context('display.max_rows', None, 'display.max_columns', None):
    print(dfssa.dtypes)
# #removeing bad rows of df because they are null for some odd reason
# dfallo = dfallo[(dfallo.WaterSourceName != 'test')]
# dfallo = dfallo[dfallo['SiteUUID'].notna()]
# dfallo = dfallo[dfallo['AllocationPriorityDateID'].notna()]
# dfallo = dfallo[dfallo['BeneficialUseCV'].notna()]
# dfallo = dfallo[dfallo['Longitude'].notna()]
# dfallo = dfallo[dfallo['Latitude'].notna()]
# dfallo.reset_index()
# #changing data type of 'Date' to datatype, then changing format of 'Date' to yyyy-mm-dd
# dfallo['Date'] = pd.to_datetime(dfallo['Date'], errors = 'coerce')
# dfallo['Date'] = pd.to_datetime(dfallo["Date"].dt.strftime('%m/%d/%Ym'))
outdfssa = dfssa


# ## Create Sites Dataframe - with attached Allo and Benuse info ##
# ########################################
# outdfallo = pd.DataFrame()

# #The Columns
# outdfallo['AA_ID'] = dfallo['AllocationAmountID'].astype(str) 
# outdfallo['SiteUUID'] = dfallo['SiteUUID'].astype(str)
# outdfallo['SN_ID'] = dfallo['AllocationNativeID'].astype(str) 
# outdfallo['Lat'] = dfallo['Latitude'].astype(float) 
# outdfallo['Long'] = dfallo['Longitude'].astype(float)
# outdfallo['WBenUse'] = dfallo['WSWCBeneficialUse'].astype(str)
# outdfallo['State'] = dfallo['State'].astype(str) 
# outdfallo['AA_CFS'] = dfallo['AllocationAmount'].astype(float) 
# outdfallo['AA_AF'] = dfallo['IrrigatedAcreage'].astype(float) 
# outdfallo['AAM_AF'] = dfallo['AllocationMaximum'].astype(float) 
# outdfallo['PD'] = dfallo['Date']
# outdfallo['WSN'] = dfallo['WaterSourceName'].astype(str)
# outdfallo['SiteTypeCV'] = dfallo['SiteTypeCV'].astype(str)
# outdfallo['WaterSourceTypeCV'] = dfallo['WaterSourceTypeCV'].astype(str)
# outdfallo['AllocationOwner'] = dfallo['AllocationOwner'].astype(str)

# outdfallo
#Exporting Outbound DataFrame to working csv file.
outdfssa.to_csv('P_SSALJSite.csv', index=False)  # The output<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16038562664329536, 'fraction_numerical': 0.0024101665205959683, 'mean_word_length': 7.695238095238095, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '483030', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1627, 'n_words': 314, 'path': 'App 4_RegulationAreas/MapRegulatoryAreas_ver1a/bonus code/PreProcessData_SiteSpecific1a.ipynb', 'repo_name': 'WSWCWaterDataExchange/WaDE2.0Apps', 'size': '4564'}