This file contains 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
# Print all numpy array, without truncation | |
import sys | |
import numpy | |
numpy.set_printoptions(threshold=sys.maxsize) | |
# Print all pandas dataframe, without truncation | |
with pd.option_context('display.max_rows', None, 'display.max_columns', None): # more options can be specified also | |
print(df) |
This file contains 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 filtro(self, df, uid): | |
"""Filter forecasted values | |
Check acceptable values, replacing when it isn't | |
""" | |
import statistics | |
if uid == 215: | |
lower_limit = 10 | |
upper_limit = 3000 | |
elif uid == 216: | |
lower_limit = 10 |
This file contains 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
y_true['ds'] = pd.to_datetime(y_true['ds']) | |
print(y_true.dtypes) |
This file contains 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
ls *VS00* *VSS.* | zip -@ saida/arquivo.zip |
This file contains 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
envio_email(){ | |
# Escrever corpo do e-mail | |
echo "Seguem anexos" >> $arq_email | |
printf "\n" >> $arq_email | |
# Arquivo de texto no corpo de e-mail | |
cat $arq_descr >> $arq_email | |
# Criar lista de e-mails a partir de arquivo | |
readarray -t lista_emails < <(cat $DIR/helpers/destinatarios_teste.txt | grep $grupo | awk -F',' '{print $1}') | |
This file contains 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
diretorio = '/home/user/model' | |
uid = 1 | |
filename = sprintf('%s/saida/saida_%s/prevaz_%s.csv', diretorio, 'semanal', uid) | |
values = tryCatch(read.csv(filename,as.is = TRUE), | |
error = function(e) NA, warning = function(w) print('Without semanal file')) |
This file contains 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
openssl rand -base64 8 |
This file contains 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 random | |
random.seed(42) | |
df['column_name'] = df['column_name'].apply(lambda v: random.random() * 100) |
This file contains 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 print_all_df(self, df): | |
with pd.option_context('display.max_rows', None, 'display.max_columns', None): | |
print(df) |
This file contains 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 subprocess import check_output | |
# List files using pattern and get most recent | |
bashCommand = ("ls -1t %s/saida/arquivos_clientes/cn*.txt | head -1" %path) | |
# Define file name as last string, striping by '/' | |
filename = str(check_output(bashCommand, shell=True).strip(), 'utf-8') | |
remoteFileName = filename.split('/')[-1] |