본문 바로가기

전체 글159

pandas 출력되는 컬럼과 줄수 설정하기 판다스에서 출력을 하면 일반적으로 10~20줄 사이로 출력이 되고 나머지는 생략이 된다 데이터의 명세를 대략적으로 보기에는 좋지만 전체 데이터를 훑어보고 싶을 때는 불편한 기능이다. 그래서 pandas에서 set.option으로 원하는 줄수 만큼 볼 수 잇다 import pandas as pd print("pandas version: ", pd.__version__) pd.set_option('display.max_row', 500) pd.set_option('display.max_columns', 100) https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html Options and settings — pandas 1.1.2 docume.. 2020. 9. 29.
python integer caching 이란? PYTHON integer caching이란? 다음 문제를 통해 알아보자 파이썬에서 다음의 결과는 무엇일까? a = 10 b = 10 a is b a에 10을 할당했고, b에도 10을 할당했다. 그리고 a와 b가 같은지를 물어보았다. 결과는 당연히 True가 나올 것이다. 실제로 해보면 다음과 같이 나온다. 너무나도 당연하다. 그럼 다음은 어떨까? a = 300 b = 300 a is b 앞과 똑같이 a에 300을 할당, b에 300을 할당, a가 b와 같은지를 물어보았다. 이번에도 당연히 정답은 True?? 실제로 실행해보면 다음과 같다. 결과는 False가 나왔다.... 왜일까..?? 우선 python에서 is()연산자에 대해 알아보자 Python에서 is operators란 파이썬에서 is oper.. 2020. 9. 21.
centos react-react-app부터 pm2까지 centos에서 react를 테스트해보기 위한 과정 react 설치 및 실행 npm install -global yarn yarn add create-react-app npx create-react-app project_name cd project_name yarn start -- 실행완료 포트 설정(react:3000) firewall-cmd --zone=public --permanent --add-port=3000/tcp firewall-cmd --reload firewall-cmd --zone=public --list-all HOST=0.0.0.0 npm run start -- 외부접속 성공 pm2설치 및 실행 npm install pm2 -g pm2 --name project_name start .. 2020. 9. 18.
Cannot add or update a child row: a foreign key constraint fails ==>참조무결성에 따라 참조키는 항상 부모키에 해당하는 값만 넣을 수 있다. 참조받는 테이블의 데이터를 먼저 삽입해서 발생한 오류. 데이터를 삭제한 뒤 참조키 설정하였다. 2020. 9. 18.
react prop types check with PropTypes https://blog.logrocket.com/validating-react-component-props-with-prop-types-ef14b29963fc/ 2020. 9. 18.
mac 안드로이드 파일전송 https://www.android.com/filetransfer/ Android File Transfer Android File Transfer Browse and transfer files between your Mac computer and your Android device. Download now For Mac OS X only. No extra software is needed for Windows. Supports macOS 10.7 and higher. www.android.com mac과 안드로이드간의 파일전송을 위해서는 위 프로그램이 필요하다. 해당 홈페이지에서 다운도르하여 간단히 설치하면 된다. 이러한 경고가 나올땐, 열기!1 네네 알겠습니다~ 시작하기!1 설치한 다음 프로그램을 실행.. 2020. 9. 18.
vscode pylance 설치 및 update 적용하기 (vscode version) vscode python 자동완성 플러그인 : pylance vscode에서 파이썬을 사용할 때, 자동완성을 이용하고 싶을 때 pylance플러그인을 설치하면 된다. pylance 링크 https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance Pylance - Visual Studio Marketplace Extension for Visual Studio Code - A performant, feature-rich language server for Python in VS Code marketplace.visualstudio.com vscode에서 언제나처럼 extensions에 pylance를 검색하여 install하면 된.. 2020. 9. 18.
npm, yarn start attempting to bind x86_64-apple-darwin npm create-react-app npm start 윈도우에서 작업한 react app을 mac에서 불러온 뒤 npm start를 해보면 다음과 같이 실행이 된다. Attempting to bind to HOST environment variable: x86_64-apple-darwin13.4.0 이렇게 나오게 된다. 그리고 내가 원했던 localhost:3000이 아니라 http://x86_64-apple-darwin13.4.0.:3000에서 실행이 되어버린다. 당연히 접속은 되지 않은다 이러한 상황은 .bashrc 또는 .bash_profile에 host가 환경변수로 저장되어 있어서 그런 것 같다. 그래서 package.json에 "open": "start http://localhost:3000".. 2020. 9. 17.
Powershell unauthorizedAccess 해결하기 windows에서 react를 사용하기 위해 yarn을 설치하는 중.... powershell에서 npm install --global yarn 을 실행 설치가 완료된 후 yarn -version 을 실행했는데 다음과 같은 오류가 발생했다. CategoryInfo : 보안오류 FullQualifiedErrorId : UnauthorizedAccess 처음엔 권한 문제라길래 관리자 권한으로 실행해보았지만, 소용이 없었다. 그래서 찾아봤더니 powershell에서는 보안 문제로 스크립트 실행을 막아놨다고 한다. 그래서 정책을 변경해야 한다 파워쉘을 관리자권한으로 실행시킨 뒤, set-executionpolicy unrestricted 이렇게하면 모든 스크립트를 허용하는 상태로 변경된다. 이렇게 한 뒤, 원래.. 2020. 9. 17.
python lambda map filter reduce 알아두면 유용하다 # lambda 함수 sum = lambda a,b : a+b print(sum(3,4)) # map 함수 li = [1,2,3] result = map(lambda i: i**2, li) print(result) print(list(result)) # 3항 연산자 ## if else def func(a): if a > 10: return 'a가 10보다 크다' else: return 'a가 10보다 작다' def func2(a): return 'a가 10보다 크다' if a > 10 else 'a가 10보다 작다' print(func(10)) print(func2(10)) # filter 함수 li = [-2,-3,5,6] def ft(li): result = [] for e in l.. 2020. 9. 13.
네이버 API 사용법 https://www.ncloud.com/ https://console.ncloud.com/dashboard https://console.ncloud.com/mc/solution/naverService/application https://console.ncloud.com/mc/solution/naverService/application?pageMode=create&version=v1 https://docs.ncloud.com/ko/naveropenapi_v3/speech/synthesis.html [사용가이드] https://apidocs.ncloud.com/ko/ai-naver/clova_speech_synthesis/ https://apidocs.ncloud.com/ko/ai-naver/clova_s.. 2020. 9. 3.
Functional JS 함수형 프로그래밍 함수형 프로그래밍이란? 더보기 자료 처리에 있어서 상태와 가변 데이터를 멀리하는 프로그래밍 패러다임 명령형 프로그래밍은 상태를 바꾸고, 함수형 프로그래밍은 함수의 응용을 중요시 함 Not functional(명령형) vs functional(함수형) 더보기 명령형 함수는 프로그램의 상태의 값을 바굴 수 있는 부작용이 있다. 이 때문에 명령형 함수는 참조 투명성이 없고, 같은 코드라도 프로그램의 상태에 따라 다른 결과값을 낸다. 반대로 함수형 코드의 출력값은 그 함수에 입력된 인수에만 의존하므로 명령형 함수의 부작용이 없다. Not Functional var name = "Anjana"; var greeting = "Hi, I'm "; console.log(greeting + name); => "Hi, I.. 2020. 9. 2.
VSCODE HTML 자동완성 snippets 설정 및 안될 때 오늘은 vscode의 Extension인 HTML Snippets를 설치해보겠습니다. 공식 페이지에서 알려주는 설치방법은 다음과 같습니다. 공식 페이지 링크 : https://github.com/abusaidm/html-snippets Installation Install Visual Studio Code 0.10.1 or higher Launch Code From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (OSX) Select Install Extension Type HTML-Snippets Choose the extension Reload Visual Studio Code 설치방법 Visual Studio Code를 설치한 뒤.. 2020. 9. 2.
파이썬 순열 조합 곱집합 구하기 from itertools import permutations or 직접구현하기 2020. 8. 31.
python list to dict 리스트 딕셔너리로 변환하기 파이썬에서 두 개의 리스트를 이용하여, 키 밸류형태의 딕셔너리로 변환하는 방법에 대해 알아보겠습니다~ list1 = ['aaa','bbb','ccc','ddd'] list2 = [11,22,33,44] dict_list= dict(zip(list1,list2)) print(dict_list) 이렇게 리스트 두개를 zip으로 묶고 dict으로 바꿔주시면 됩니다 python에서 zip은 인덱스를 기준으로 리스트를 순서대로 가져온다고 생각하면 됩니다. 예제 코드를 보시죠 list1 = ['aaa','bbb','ccc','ddd'] list2 = [111,222,333,444] for x,y in zip(list1, list2): print(x,y) 이렇게 실행하시면 list1과 list2의 요소를 하나씩 순서.. 2020. 8. 31.