일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
- Excel
- 다이어트
- pandas
- 유니티
- 라즈베리파이
- 리눅스
- MS-SQL
- swift
- 날짜
- IOS
- Linux
- ubuntu
- python
- Unity
- mssql
- sqlite
- MySQL
- 맛집
- flutter
- 함수
- tensorflow
- PyQt5
- ASP
- PyQt
- GIT
- node.js
- javascript
- port
- PER
- urllib
아미(아름다운미소)
try: s3.put_object(...)except Exception as e: print(f"Error: {e.response['Error']['Code']}") # AccessDenied, KMS.Disabled 등
import pandas as pd# Parquet 파일 읽기df = pd.read_parquet('example.parquet')# 전체 데이터 출력print("전체 데이터:")print(df)# 상위 5행 출력print("\n상위 5행:")print(df.head())# 데이터 구조 확인print("\n데이터 구조:")print(df.info())# 기술 통계 정보print("\n기술 통계:")print(df.describe())
import yaml# YAML 파일 로드with open('config.yml') as f: config = yaml.safe_load(f)# 값 접근print(config['app']['name']) # "My Awesome App"print(config['database']['production']['credentials']['username']) # "admin"# 리스트 항목 접근for feature in config['app']['features']: print(feature)app: name: "My Awesome App" version: 2.3.1 features: - "authentication" - "data_export" - "notification..
DB_HOST: localhostDB_PORT: 3306DB_USER: rootDB_PASSWORD: secret import yamlwith open("env.yml", "r") as f: config = yaml.safe_load(f)print(config["DB_HOST"])
IAM → 사용자 → 해당 사용자 클릭 → "권한" 탭 → 정책 추가AmazonS3FullAccess 또는 최소 다음 권한 포함:콘솔에서 권한 확인하는 방법1. AWS 콘솔 접속: https://console.aws.amazon.com/2. 좌측 상단 검색창에 IAM 입력 → 이동3. 좌측 "사용자" 클릭4. → 코드에서 조회된 사용자 이름 클릭5. → "권한" 탭 확인6. AmazonS3FullAccess 또는 아래 정책이 있어야 boto3로 S3 접근 가능:{ "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject", "s3:PutObject", "s3:DeleteObject" ], "Resource": [ "a..
예제1import pandas as pd# --------------------------------------------# 1. 샘플 데이터 생성# --------------------------------------------df = pd.DataFrame({ 'a': [1, 2, 3, 4], 'b': ['A', 'B', 'C', 'D'], 'c': [10, 20, 30, 40]})df2 = pd.DataFrame({ 'a': [1, 2, 3, 5], 'b': ['A', 'X', 'C', 'E'], 'c': [10, 20, 30, 50]})# --------------------------------------------# 2. 비교 방법 구현# ------------..
최적화 최존def process_dataframe_optimized(dict_df_types, df): type_handlers = { 'int': lambda s: pd.to_numeric(s, errors='coerce').fillna(0).astype('int32'), 'float': lambda s: pd.to_numeric(s, errors='coerce').fillna(0).astype('float32'), # float32로 변경 'bool': lambda s: s.astype(str).str.lower().isin(['true', 't', '1']), # 더 넓은 불리언 조건 'datetime': lambda s: pd.to_dat..
# 날짜 변환 (NULL → NaT)dates = pd.to_datetime(df['a'], errors='coerce')if not dates.empty and not pd.isna(dates.iloc[0]): first_date = dates.iloc[0]else: first_date = pd.to_datetime('today') # 기본값 설정
index.duplicated() 메서드 사용# 중복된 인덱스 위치 확인duplicated = df.index.duplicated(keep='first') # 첫 번째 발생은 False, 이후 중복은 Trueprint(duplicated)# 출력: [False False True False]# 중복된 인덱스 값 확인duplicated_values = df.index[df.index.duplicated()]print(duplicated_values)# 출력: Index(['b'], dtype='object')value_counts()로 중복 횟수 확인# 각 인덱스 값의 발생 횟수 확인index_counts = df.index.value_counts()print(index_counts)# 출력:# b ..
import pandas as pdfrom pandas_profiling import ProfileReport# 1. 데이터프레임 준비 (예시)df = pd.read_csv("your_data.csv")# 2. 프로파일링 리포트 생성 → 가장 먼저 실행!profile = ProfileReport(df, explorative=True)# 3. (선택사항) 추가 설정 (예: 제목 변경, 변수 조정)profile.set_variable("title", "My Custom Report")# 4. 최종 저장 → 마지막에 실행!profile.to_file("report.html")from pandas_profiling import ProfileReportprofile = ProfileReport(df, explo..