<jupyter_start><jupyter_text>Paso 1: Quitar NAs' de códigos postales:<jupyter_code>DB['CP'].count()
DB.count()
DB = DB.dropna(subset=['CP'])
DB = DB.reset_index()
DB
DB.count()<jupyter_output><empty_output><jupyter_text>*** Paso 2: quitar valores atípicos<jupyter_code>for i in range(len(DB)):
    if DB['provedores_nacionales'][i]>100:
        DB.loc[i,'provedores_nacionales'] = np.nan
        
    if DB['ventas_porcentaje'][i]>100:
        DB.loc[i,'ventas_porcentaje'] = np.nan
        
    if DB['perdidas_porcentaje'][i]>100:
        DB.loc[i,'perdidas_porcentaje'] = np.nan
        
    if DB['capacidad'][i]>100:
        DB.loc[i,'capacidad'] = np.nan
        
    if DB['plantilla_porcentaje'][i]>100:
        DB.loc[i,'plantilla_porcentaje'] = np.nan
        
    if DB['pago_impuestos'][i] == "No contesto":
        DB.loc[i,'pago_impuestos'] = np.nan
        
    if DB['pago_creditos'][i] == "No contesto":
        DB.loc[i,'pago_creditos'] = np.nan
        
    if DB['pago_renta'][i] == "No contesto":
        DB.loc[i,'pago_renta'] = np.nan
        
    if DB['pago_internet'][i] == "No contesto":
        DB.loc[i,'pago_internet'] = np.nan
        
    if DB['pago_agua'][i] == "No contesto":
        DB.loc[i,'pago_agua'] = np.nan
        
    if DB['pago_luz'][i] == "No contesto":
        DB.loc[i,'pago_luz'] = np.nan
        
    if DB['pago_gas'][i] == "No contesto":
        DB.loc[i,'pago_gas'] = np.nan
        
    if DB['pago_proporcion'][i]>120:
        DB.loc[i,'pago_proporcion'] = np.nan
        
    if DB['capacidad_pago_credito'][i] == "No contesto":
        DB.loc[i,'capacidad_pago_credito'] = np.nan
        
    if DB['credito_prorroga'][i] == "No contesto":
        DB.loc[i,'credito_prorroga'] = np.nan
    if DB['credito_prorroga'][i] == 998:
        DB.loc[i,'credito_prorroga'] = np.nan
    if DB['credito_prorroga'][i] == 999:
        DB.loc[i,'credito_prorroga'] = np.nan
        
    if DB['informado'][i] == "No contesto":
        DB.loc[i,'informado'] = np.nan
        
    if DB['lineamientos'][i] == "No contesto":
        DB.loc[i,'lineamientos'] = np.nan   
DB
DB.describe()
DB['Sector'].unique()
Ocurrency = DB['Sector'].value_counts()
import plotly.graph_objects as go

labels = ['Comercio', 'Construcción', 'Manufactura', 'Servicios']
values = [Ocurrency[0], Ocurrency[1], Ocurrency[2], Ocurrency[3]]

# Use `hole` to create a donut-like pie chart
fig = go.Figure(data=[go.Pie(labels=labels, values=values, hole=.4)])
fig.show()
DB['aumento_precios'].unique()
Increase = DB['aumento_precios'].value_counts()
Increase = DB['aumento_precios'].value_counts()
Increase
import plotly.graph_objects as go

fig = go.Figure(
    data=[go.Bar(y=[Increase[0], Increase[1],Increase[2],Increase[3],Increase[4]])],
    layout_title_text="Aumento de Precios"
)

fig.show()
Municipio = DB['Municipio'].value_counts()
Municipio
import plotly.graph_objects as go

fig = go.Figure(data=[go.Scatter(
    x=DB['Municipio'], y=Municipio,
    mode='markers',
    marker_size=[40, 60, 80, 100])
])

fig.show()
#Sector vs Conocimiento_apoyo

import plotly.express as px
import pandas as pd

schools = ["Brown", "NYU", "<NAME>", "Cornell", "Tufts", "Yale",
           "Dartmouth", "Chicago", "Columbia", "Duke", "Georgetown",
           "Princeton", "U.Penn", "Stanford", "MIT", "Harvard"]
n_schools = len(schools)

men_salary = [72, 67, 73, 80, 76, 79, 84, 78, 86, 93, 94, 90, 92, 96, 94, 112]
women_salary = [92, 94, 100, 107, 112, 114, 114, 118, 119, 124, 131, 137, 141, 151, 152, 165]

df = pd.DataFrame(dict(school=schools*2, salary=men_salary + women_salary,
                       gender=["Men"]*n_schools + ["Women"]*n_schools))

# Use column names of df for the different parameters x, y, color, ...
fig = px.scatter(df, x="salary", y="school", color="gender",
                 title="Gender Earnings Disparity",
                 labels={"salary":"Annual Salary (in thousands)"} # customize axis label
                )

fig.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18065967016491755, 'fraction_numerical': 0.031234382808595702, 'mean_word_length': 3.3558215451577804, 'pattern_counts': {'":': 12, '<': 10, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '121676', 'license': 'MIT', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1554, 'n_words': 287, 'path': 'Documents/ITESO/OneDrive - ITESO/ITESO/9no Semestre/PAP Intermediarios Financieros/Urban_Lab_Desarrollo-master/Job/Sprint 3/Analisis_Descriptivo_IIEG_E_1.ipynb', 'repo_name': 'JobRamirezC/Urban_Lab_Desarrollo', 'size': '4006'}