Ejemplo n.º 1
0
def get_df_simple():
    df20 = ebu.get_dataframe_2020()

    df19 = ebu.open_combine_2019()

    df = pd.merge(df19,
                  df20,
                  left_index=True,
                  right_index=True,
                  suffixes=['_19', '_20'],
                  how='inner')
    return df
Ejemplo n.º 2
0
MAX_WITH = 800
PATH_OUT = 'docs/Ejemplos/z050_panel.html'
FILE_OUT = os.path.join(os.path.dirname(ebu.DIR), PATH_OUT)

COL_LLEGO = '#aaaaaa'
COL_FALTA = '#db2879'

# bokeh.plotting.output_file(os.path.join(os.path.dirname(ebu.DIR),
#                                         PATH_OUT))
# bokeh.plotting.output_notebook()

# %% [markdown]
# ## code

# %%
df2 = ebu.get_dataframe_2020()

# %%

# %%

# %%
bokeh.plotting.output_notebook()

df2 = ebu.add_jitter(df2)
cols = ['yj', 'xj', 'PAIS', 'MUN', 'REC', 'HAB', 'COU']

df2['COU'] = 'No'
df2.loc[df2['COUNT'], 'COU'] = 'Sí'

s1 = df2[df2['COUNT']][cols]
Ejemplo n.º 3
0
import sys
sys.path.append(".")
#from elec_bol20 import *
import elec_bol20 as eb
import elec_bol20.util as ebu
import elec_bol20.tools as ebt
import os
import datetime
#df0 = ebu.open_combine_2019()
df0 = ebu.get_dataframe_2020()
z = ebt.CartoPlots()
y = z.load_file(df0, _mean=['X', 'Y', 'LAT', 'LON', 'DEN', ], _sum=['HAB', 'CC', 'MAS','CREEMOS', 'FPV','PAN_BOL','VV'],
                _first=['PAIS', 'REC', 'MUN', 'BOL'])
# stamp Bolivian time at the moment of plotting
bot_time = ebu.get_bolivian_time(-3)["str_val"]
#print(bot_time)

# goal_dir = os.path.join(ebu.DIR)

#par dir ya esta en elec-bol20
# par_dir = os.path.pardir(goal_dir)
# print(os.path.join(par_dir,"asdf"))

#path_cart_maps=os.path.join(os.getcwd().,"../../carto_maps")
#print(path_cart_maps)
#
# x1 = z.plot_carto_single(y, 'diff', ebu.P_DIF,path=path_cart_maps, name_file=bot_time, low=0, high=100, show_plot=False)
# x2 = z.plot_carto_single(y, 'mas', ebu.P_GRAD_MAS,path=path_cart_maps, name_file=bot_time, low=0, high=100, show_plot=False)
# x3 = z.plot_carto_single(y, 'cc', ebu.P_GRAD_CC, path=path_cart_maps, name_file=bot_time, low=0, high=100, show_plot=False)
# x4 = z.plot_carto_single(y, 'creemos', ebu.P_GRAD_CREEMOS, path=path_cart_maps, name_file=bot_time, low=0, high=100, show_plot=False)
# x5 = z.plot_carto_single(y, 'pan_bol', ebu.P_GRAD_PANBOL, path=path_cart_maps, name_file=bot_time, low=0, high=100, show_plot=False)
Ejemplo n.º 4
0
def process_data(df2):
    ll = len(df2)
    np.random.seed(100)
    df2['xj'] = df2['X'] + np.random.rand(ll) * .5
    np.random.seed(200)
    df2['yj'] = df2['Y'] + np.random.rand(ll) * .5

    df2['COU'] = 'No'
    df2.loc[df2['COUNT'], 'COU'] = 'Sí'
    return df2


df2 = ebu.get_dataframe_2020(path=ebu.FULL_COMP_CONCAT_CSV,
                             col2keep=[
                                 'VV', 'BL', 'NU', 'VOTO_EMITIDO', 'CREEMOS',
                                 'MAS', 'FPV', 'PAN_BOL', 'CC', 'NUA', 'HAB',
                                 'TIMESTAMP', 'P_COMP'
                             ])

main(df2)

# %%
_df['P_COMP']

# %%
df2.columns

# %%
IS = 5
_df = df2[['xj', 'yj', 'P_COMP']].copy()
_df = _df.dropna(how='any')