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 pyspark.sql.functions import col, explode_outer | |
from pyspark.sql.types import * | |
from copy import deepcopy | |
from autoflatten import AutoFlatten | |
from collections import Counter | |
s3_path = 's3://mybucket/orders/' | |
df = spark.read.orc(s3_path) | |
json_df = spark.read.json(df.rdd.map(lambda row: row.json)) | |
json_schema = json_df.schema |
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 json | |
class AutoFlatten: | |
def __init__(self, json_schema): | |
self.fields_in_json = self.get_fields_in_json(json_schema) | |
self.all_fields = {} | |
self.cols_to_explode = set() | |
self.structure = {} | |
self.order = [] | |
self.bottom_to_top = {} |
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
##### READ SPARK DATAFRAME | |
df = spark.read.option("header", "true").option("inferSchema", "true").csv(fname) | |
# store the schema from the CSV w/ the header in the first file, and infer the types for the columns | |
df_schema = df.schema | |
##### SAVE JSON SCHEMA INTO S3 / BLOB STORAGE | |
# save the schema to load from the streaming job, which we will load during the next job | |
dbutils.fs.rm("/home/mwc/airline_schema.json", True) | |
with open("/dbfs/home/mwc/airline_schema.json", "w") as f: |
유니코드에서 한글을 어떻게 다루는지를 정리하였다.
- 유니코드(Unicode)는 전 세계의 모든 문자를 컴퓨터에서 일관되게 표현하고 다룰 수 있도록 설계된 산업 표준 (위키 백과)
- 단순히 문자마다 번호를 붙임
- 계속 업데이트되며 현재는 Unicode Version 9.0.0 이 최신이다.
- 유니코드를 실제 파일 등에 어떻게 기록할 것인지를 표준화한 것이다.
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
#!/bin/bash | |
com=${1:-"htop"} | |
tname=mon | |
twin=mon | |
tnw=$tname:$twin | |
tmux has-session -t $tname | |
if [ $? != 0 ] | |
then | |
tmux new-session -s $tname -n $twin -d ssh -t a1 "$com" |
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 luigi modules | |
import luigi | |
from luigi.contrib import redshift | |
from luigi import configuration, s3 | |
# import python core modules | |
import os | |
import shutil | |
import datetime |
글쓴이: 김정주(haje01@gmail.com)
최근 딥러닝 관련 패키지들은 대부분 CPU와 GPU를 함께 지원하고 있습니다. GPU를 사용하면 보다 빠르게 학습 결과를 낼 수 있지만, GPU를 활용하기 위해서는 NVIDIA계열의 그래픽 카드, 드라이버 S/W 그리고 CUDA의 설치를 필요로 합니다.
이 글에서는 AWS의 GPU 인스턴스와 도커를 활용해 딥러닝 패키지(Caffe)를 편리하게 사용하는 방법을 소개합니다.
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
- 스프링부트는 단독실행되는, 실행하기만 하면 되는 상용화 가능한 수준의, 스프링 기반 애플리케이션을 쉽게 만들어낼 수 있다.
- 최소한의 설정으로 스프링 플랫폼과 서드파티 라이브러리들을 사용할 수 있도록 하고 있다.
NewerOlder