<jupyter_start><jupyter_text>Small Business Administration    Paycheck Protection Program Recipients    Wrangling $150k &amp; Below Loans<jupyter_code>import pandas as pd
df=pd.read_csv(r'D:\Documents\Projects\PPP All States.csv',low_memory=False,index_col=0)
ppp=df.copy()
ppp.head()
ppp.info()
ppp.NAICSCode.unique()
p=ppp.copy()
p.NAICSCode = p.NAICSCode.fillna(0)
display(ppp.head(1))
#pd.to_numeric(p.NAICSCode)
p.NAICSCode=p.NAICSCode.astype(int)
display(ppp.head(1))
industry=pd.read_csv(r'D:\Documents\Projects\naics industry.csv')
print(industry.head(1))
sector=pd.read_csv(r'D:Documents\Projects\naics sector.csv')
print(sector.head(1))
industry.industry.str.strip()
print(industry.head(1))
sector.Description.str.strip()
print(sector.head(1))
code=industry.naics.tolist()
desc=industry.industry.tolist()
scode=sector.Sector.tolist()
sdesc=sector.Description.tolist()
print(desc[0:3])
des=[]
for d in desc:
    des.append(d.rstrip(' '))
print(des[0:3])
desc=des
print(desc[0:3])
pcodes=ppp.NAICSCode.tolist()
ind=[]
sec=[]
secC=[]
for p in pcodes:
    pc=str(p)
    try:
        p=int(pc[:-2])
        sc=int(pc[:2])
        try:
            index=code.index(p)
            ind.append(desc[index])
            sindex=scode.index(sc)
            sec.append(sdesc[sindex])
            secC.append(int(scode[sindex]))
        except:
            ind.append('NA')
            sec.append('NA')
            secC.append(0)
    except:
        ind.append('NA')
        sec.append('NA')
        secC.append(0)
ppp['Industry']=ind
ppp['SectorCode']=secC
ppp['Sector']=sec
ppp.head()
ppp.to_csv(r'D:\Documents\Projects\PPP All States Updated.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17064439140811455, 'fraction_numerical': 0.012529832935560859, 'mean_word_length': 4.036036036036036, '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': '631129', 'license': 'MIT', 'n_tokens_mistral': 679, 'n_tokens_neox': 671, 'n_words': 87, 'path': 'PPP Recipients 150 below wrangle.ipynb', 'repo_name': 'kareemwri/Paycheck-Protection-Program', 'size': '1676'}