This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import holidays | |
def get_quincenas(start_date, end_date): | |
mx_holidays = holidays.country_holidays('MX') | |
date_range = pd.date_range(start_date, end_date, freq='D') | |
quincenas = [] | |
for d in date_range: | |
if d.day == 15 or d.is_month_end: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def df_to_values(df, name = 'tmp', first = True): | |
template = "{name} as (select * from (values {values}) as t ({columns}))" | |
if first: template = "with {}".format(template) | |
names = df.columns | |
values = df.values.tolist() | |
rows = [] | |
for items in values: | |
row = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from requests import get | |
import os | |
import uuid | |
print('Reading list...') | |
df = pd.read_excel('list.xlsx') | |
f = df.to_dict(orient='records') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getMails() { | |
var sheetId = ''; // use your Sheets ID here | |
var ss = SpreadsheetApp.openById(sheetId); | |
var s = ss.getSheetByName('logger'); | |
var threads = GmailApp.search('-in:trash'); | |
var a=[]; | |
for (var i = 0; i < threads.length; i++) { | |
var messages = GmailApp.getMessagesForThread(threads[i]); | |
for (var j = 0; j < messages.length; j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import cx_Oracle | |
ora_conn = cx_Oracle.connect('your_connection_string') | |
df_ora = pd.read_sql('select * from user_objects', con=ora_conn) | |
print 'loaded dataframe from Oracle. # Records: ', len(df_ora) | |
ora_conn.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.support import ui | |
from selenium.webdriver.common.keys import Keys | |
import time | |
cargas = ['500', '300', '200', '150', '100', '50', '30', '20'] | |
dict_cargas = {} | |
i = 0 | |
for c in cargas: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import pandas as pd | |
import re | |
pnn = pd.read_csv('pnn_Publico_01_03_2017.csv', encoding='Latin-1', index_col=False) | |
n = [] | |
for i in list(pnn.columns): | |
n.append(i.strip().replace(' ','_')) |