Skip to content

Instantly share code, notes, and snippets.

View su79eu7k's full-sized avatar
🎯
Focusing

su79eu7k su79eu7k

🎯
Focusing
  • Seoul, Korea
View GitHub Profile
@su79eu7k
su79eu7k / asnyc_sqlalchemy_core_on_fastapi.py
Last active June 23, 2022 14:47
Asynchronous DB I/O with SQLAlchemy Core on FastAPI
import asyncio
from fastapi import FastAPI
from pydantic import BaseModel
from typing import List
import sqlalchemy
from sqlalchemy.ext.asyncio import create_async_engine
engine = create_async_engine(
"sqlite+aiosqlite:///simulations.db", echo=True, future=True
)
@su79eu7k
su79eu7k / sap_bapi.py
Created April 2, 2021 06:54
SAP BAPI with pyrfc
import pandas as pd
from pyrfc import Connection, ABAPApplicationError, ABAPRuntimeError, LogonError, CommunicationError
class RFC_Handle(object):
def __init__(self):
self.conn = None
def login(self, sap_id, sap_pwd):
try:
@su79eu7k
su79eu7k / sap_table_access_and_report_generation.py
Created April 2, 2021 06:46
SAP table access and report generation with pyrfc
import pandas as pd
from pyrfc import Connection, ABAPApplicationError, ABAPRuntimeError, LogonError, CommunicationError
class RFC_Handle(object):
def __init__(self):
self.conn = None
def login(self, sap_id, sap_pwd):
try:
@su79eu7k
su79eu7k / sap_login.py
Created April 2, 2021 06:34
SAP login with pyrfc
from pyrfc import Connection, ABAPApplicationError, ABAPRuntimeError, LogonError, CommunicationError
class RFC_Handle(object):
def __init__(self):
self.conn = None
def login(self, sap_id, sap_pwd):
try:
self.sap_id = sap_id
@su79eu7k
su79eu7k / handle_last_index.py
Last active February 6, 2021 14:01
grouping/chunking elements with last_index.
def handle_last_index(elements, last_index):
grouped = []
for i, _ in enumerate(last_index):
if i == 0:
grouped.append(' '.join(elements[:last_index[i] + 1]))
elif i == len(last_index) - 1:
grouped.append(' '.join(elements[last_index[i - 1] + 1:]))
else:
grouped.append(' '.join(elements[last_index[i - 1] + 1:last_index[i] + 1]))
@su79eu7k
su79eu7k / pmml_bayesnet.ipynb
Created December 6, 2018 12:51 — forked from rtbs-dev/pmml_bayesnet.ipynb
Bayesian Network Models in PyMC3 and NetworkX
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@su79eu7k
su79eu7k / distcorr.py
Created April 19, 2018 02:01 — forked from satra/distcorr.py
Distance Correlation in Python
from scipy.spatial.distance import pdist, squareform
import numpy as np
from numbapro import jit, float32
def distcorr(X, Y):
""" Compute the distance correlation function
>>> a = [1,2,3,4,5]
>>> b = np.array([1,2,9,4,4])