일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- parasite
- cnn
- 미중
- everybody wants you
- 코로나19
- wuhan
- 정은경 본부장님
- 최성재
- 진짜영웅
- 어서와한국은처음이지
- 우한코로나
- 웨일즈
- sharonchoi
- 중국외교부
- 치앙마이
- 조현병
- 우한코로나바이러스
- 봉준호감독통역사
- 코로나바이러스
- 우한
- 확진자수
- red hearse
- 봉준호감독통역
- Bolton
- 전염병
- 코로나
- 필리핀사망
- 창궐
- 우한 코로나
- 신종코로나
- Today
- Total
목록개발노트/Python (62)
오지's blog
from streamlit_extras.stylable_container import stylable_containerimport streamlit as stst.title("Chat with the documents")if "messages" not in st.session_state: st.session_state["messages"] = []def generate_response(prompt): return f"This is a response to: {prompt}", 0, 0, 0for message in st.session_state["messages"][1:]: with st.chat_message(message["role"]): st.markdown(messag..
create or replace function csv_text_chunker(file_url string)returns table (chunk varchar)language pythonruntime_version = '3.9'handler = 'csv_text_chunker'packages = ('snowflake-snowpark-python','pandas', 'langchain')as$$from snowflake.snowpark.types import StringType, StructField, StructTypefrom langchain.text_splitter import RecursiveCharacterTextSplitterfrom snowflake.snowpark.files import Sn..
connection_args = {"user":SNOWFLAKE_IMED_DB_USER ,"private_key":pkb ,"account":SNOWFLAKE_IMED_DB_HOST ,"warehouse":'GCIMED_WH' ,"database":'GCIMED_DB' ,"schema":'DM'}with snow.connect(**connection_args) as conn:
import datetimefrom pytz import UTCoriginal_time = datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=UTC).timestamp()now = datetime.datetime.now().timestamp()
result = engine.execute(f"SELECT TABLE_NAME FROM information_schema.TABLES WHERE ENGINE LIKE '%InnoDB%' AND TABLE_TYPE='BASE TABLE';").fetchone() ValueError: unsupported format character 'I' (0x49) at index 69 에러 발생 % 대신 %%으로 수정하여 해결 result = engine.execute(f"SELECT TABLE_NAME FROM information_schema.TABLES WHERE ENGINE LIKE '%%InnoDB%%' AND TABLE_TYPE='BASE TABLE';").fetchone()
s3의 특정버킷내 stackoverflow를 보면서 아름다운 코드를 발견하여 이에 기록하게 되었다. https://stackoverflow.com/questions/45375999/how-to-download-the-latest-file-of-an-s3-bucket-using-boto3 How to download the latest file of an S3 bucket using Boto3? The other questions I could find were refering to an older version of Boto. I would like to download the latest file of an S3 bucket. In the documentation I found that there is..

간단하지만 생각의 전환으로 쉽게 해결하는 방법. excel에서는 각각의 컬럼에서 병합된쎌이 있는 경우가 있다. 마치 이런경우 위엑셀파일을 데이터프레임으로 읽으면 첫번째부터 세번째 컬럼명은 Unnamed :0, .. Unnamed:2라고 나온다. 이때 엑셀파일을 건들 생각을 하면 한발자국 나아가면 될것을 운동장 한바퀴 돌아가는 격이 된다. 이런경우가장 쉽게 데이터프레임으로 읽어서 csv로 바꾸는 방법은 pandas의 rename함수를 이용하는 것이다 다음과 같이... df.rename(columns={'Unnamed: 0': '날짜/시간', 'Unnamed: 1': '부서', 'Unnamed: 2':'상담원명'}, inplace=True) 별거 아니지만 생각의 전환이 필요한 부분이다.
# double underscore __ == dunder -> 객체에서 특별한 행위를 했을때 내부적으로 호출하는 메소드 + 의 경우 __add__()호출 class Person: def __init__(self, name, age): self.name = name self.age = age def __del__(self): print("Object is being deconstructed") p = Person("Kelly", 35) class Vector: def __init__(self, x, y): self.x = x self.y = y v1 = Vector(10, 20) v2 = Vector(50, 50) # v3 = v1 + v2 # __add__함수를 정의하지 않은 상태에서 두 객체를 더하면..
오픈소스 프로젝트의 소스를 분석해보자 남이쓴 코드를 많이 보자

Worksheet index 0 is invalid, 0 worksheets found 혹은 openpyxl AttributeError: 'NoneType' object has no attribute 'rows' 에러가 발생한다. 분명히 xlsx파일이고 sheet가 존재한다. 왜일까? 알고보니 맥북이나 윈도우컴에서 Excel Workbook이 아닌 Strict Open XML Spreadsheet xlsx로 저장했기 때문이다. (O) (X)