레이블이 WebKnowledgeIndex인 게시물을 표시합니다. 모든 게시물 표시
레이블이 WebKnowledgeIndex인 게시물을 표시합니다. 모든 게시물 표시

2014년 5월 21일 수요일

20140521 오늘 찾은 Python 팁 - Array & List 위주

요약

  • numpy
  • [x for x in array]
  • slice[:, :]
  • map(operation, array, array)
이것들이면 대부분 해결된다.


본론

어떤 Array의 각 원소에 대해서 산술 연산을 하고 싶다면?

numpy.array()를 이용해서 연산
[수식 for 변수 in Array]

아니면 map()으로도 가능

다차원 Array 자르고 붙이기 (영상처리시 색상 채널 분리 등에 유용)

Array 가로세로 모양 바꾸기

다차원 Array 모든 원소의 합 구하기

일반 sum() 대신 numpy.sum() 사용

초기 크기를 지정하여 Array 생성하기

기본적인 형태는 [None] size 이렇게 사용. 아래처럼 다차원도 가능. [[None] sizeX] * sizeY

Array 원소단위 계산

map()

Array 원소 Type Casting

numpy.array()로 생성하여 arr.astype()을 사용하거나
map()을 사용

축약함수 (Lambda)

Lisp 스타일 - Reduce https://wikidocs.net/64

제곱근 구하기

제곱근 ** 연산자나 pow() 함수 등에 분수값을 사용. float 타입으로 사용해야 함.

기타

Python 데이터 분석 라이브러리 “Pandas” http://pandas.pydata.org/

2014년 5월 12일 월요일

읽은 웹페이지 기록 20140512월

Google Apps Script (1)

Class Logger - Google Apps Script — Google Developers https://developers.google.com/apps-script/reference/base/logger
Document Service - Google Apps Script — Google Developers https://developers.google.com/apps-script/reference/document/
Class Blob - Google Apps Script — Google Developers https://developers.google.com/apps-script/reference/base/blob#getAs(String)
HTML Service: Create and Serve HTML - Google Apps Script — Google Developershttps://developers.google.com/apps-script/guides/html/#serve_html_as_a_google_docs_sheets_or_forms_user_interface
Google Apps Script 대시보드 - Google 드라이브https://script.google.com/dashboard

Google Apps Script (2)

google apps script - cursorPos.insertInlineImage() gives error: "We're sorry, a server error occurred. Please wait a bit and try again" - Stack Overflowhttp://stackoverflow.com/questions/22277368/cursorpos-insertinlineimage-gives-error-were-sorry-a-server-error-occurred
javascript - How to load an Array (of numbers) into a google app script Byte[] - Stack Overflowhttp://stackoverflow.com/questions/20630661/how-to-load-an-array-of-numbers-into-a-google-app-script-byte

JavaScript, Base64, byte array

Convert a base64 string into a binary Uint8 Arrayhttps://gist.github.com/borismus/1032746
베이스64 - 위키백과, 우리 모두의 백과사전http://ko.wikipedia.org/wiki/%EB%B2%A0%EC%9D%B4%EC%8A%A464

크로스도메인, jQuery, JSONP

스토브 훌로구 :: CrossDomain Ajax 호출 #1 : jQuery JSONP ajax 호출 이용.http://stove99.tistory.com/10
사과 냄새나는 IT이야기 TAESTORY, :: [jsp] jsonp를 이용한 다른 도메인간의 ajax / json 통신 (크로스도메인) http://tskwon.tistory.com/312
jquery - $.ajax and JSONP. ParseError and Uncaught SyntaxError: Unexpected token : - Stack Overflowhttp://stackoverflow.com/questions/10507345/ajax-and-jsonp-parseerror-and-uncaught-syntaxerror-unexpected-token

읽은 웹페이지 기록 20140511일

뭔가 내가 읽고 알게 된 내용들에 대해서 남겨놓고 싶은데 다 정리하기는 그렇고 해서 블로그 글로 한 번씩 키워드, 링크 목록을 정리해보기로 하였다. 말하자면 내 학습, 기억에 대한 인덱스같은 것이다.

HTML5 Graphics

drawingboard.js, Simple HTML5 Drawing / Sketch App https://github.com/Leimi/drawingboard.js
Paper.js = HTML5 Canvas = Bitmaphttps://github.com/paperjs/paper.js
Raphael.js = HTML5 Inline SVG = Vectorhttps://github.com/DmitryBaranovskiy/raphael/

JavaScript, CoffeeScript

Google Apps Script, Drive / Docs add-ons

QRCode

GitHub

Git + Hub = GitHub http://hub.github.com/