본문 바로가기

전체 글345

Draw Graph with MatPlotLib in Python matplotlib is used for data visualization in Python. Especially, this library is lively used in data engineering. Installation If you want to locally install this library, you can use pip. $ pip install matplotlib I will use Google's Colab for further posting. Requirements import numpy as np import matplotlib.pyplot as plt from PIL import Image import cv2 %matplotlib inline I will use those pack.. 2021. 2. 25.
[Git] Tip: Change committer and author from already committed commit If you use multiple accounts for git, you can make a mistake. I sometimes make a mistake as well. Let's fix this. I made a test repository with a test account. Now, do the magic! git filter-branch -f --env-filter ' OLD_EMAIL="old@test.com" NEW_NAME="NewName" NEW_EMAIL="new@test.com" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$NEW_NAME" export GIT_COMMITTER_EMAIL.. 2021. 2. 15.
[Python] Introduce to DearPyGui 그동안 Python GUI 툴로 PyQt5를 사용하고 있었는데, 디자인에 대한 갈증을 계속 느꼈었습니다. 다른 프레임워크나 라이브러리들도 투박하기는 매 한가지고, QtDesigner는 번거롭고 불편해서 차라리 그냥 코딩해서 디자인 해왔었어요. dearpygui는 알고는 있었는데 크게 흥미가 가지 않아 사용하지 않았다가 얼마전 주말에 심심해서 잠깐 갖고 놀아보니 할만 하더라고요. 자료가 워낙 부족해서 삽질을 좀 했네요. 그러고나니 불가능 한 것과 가능한 것, 꼼수로 할 수 있는 것들을 좀 알겠더라고요. 그래서, 퇴근 후 한 두시간씩 틈틈히 삽질해서 간단하게 로또번호 추출기를 한 번 만들어 봤어요. 하는 김에 요즘 파이썬 진영에도 점점 확산되고 있는 type hint도 사용해봤고요. 아직 numpy나 ker.. 2021. 2. 11.
[Python] argparse module The argparse module makes it easy to write user-friendly command-line interfaces. Basics of argparse Module Let's make the application for argparse module, and using it. main.py import argparse if __name__ == '__main__': parser = argparse.ArgumentParser() args = parser.parse_args() That's it. How easy and how simple! Now, use our application. $ python main.py xxx $ python main.py -h This is the .. 2021. 2. 3.
[PyCharm] Shortcuts Code Completion - ⌃Space Format one line - ⌃⌥I Format current file - ⌥⇧⌘L 2021. 1. 31.
[PyCharm] Run Flask Application on PyCharm In this posting, I explain how to run the Flask application on PyCharm. Installation On Mac I used the HomeBrew for installation. $ brew insstall --cask pycharm-ce On Windows I used the Chocolatey for installation. $ choco install -y pycharm-community Flask Application Let's make a very simple application for testing. from flask import Flask app = Flask(__name__) @app.route('/') def hello(): ret.. 2021. 1. 26.
[Python] Non-Keyword Arguments and Keyword Arguments Python has methods to pass a number of arguments to a function. Let's figure it out. Non-Keyword Arguments It is not compulsory, but it is mainly used in the form *args. This is the basic usage. def testArgs(*args): for arg in args: print(arg) testArgs('hello', 'world', 7, 3.14) # hello # world # 7 # 3.14 You can pass a number of arguments with this method. Let's test with the normal arguments. .. 2021. 1. 22.
[Python] 3 Ways of Formatted String There are 3 ways to write a formatted string in Python3. Let's check it one by one. Formatted String with Placeholder This method seems like a C language. It uses string-formatting operator %. print("String: %c, %s" % ('h', 'python')) # String: hello, python print("Integer: %d, %i" % (3, 7)) # Integer: 3, 7 print("Floating: %f, %F, %3.2f" % (2.818, 1.414, 3.14159)) # Floating: 2.818000, 1.414000.. 2021. 1. 22.
[Excel] 팁: 셀 숨기기/보이기 단축키 (Hide/Unhide Shortcuts) 엑셀 시트를 공유하거나 화면 공유로 회의를 하다보면 불필요한 셀들을 숨겨놓다가 필요할 때만 보이는 일이 많죠. 이 기능을 단축키를 사용해서 빠르고 편리하게 사용해 봅시다. 먼저 예를 들기 위해 간단하게 표를 만들었습니다. 행 숨기기/보이기 먼저, 행을 숨겨 보겠습니다. 숨기고자 하는 행을 선택하고, 단축키를 눌러 줍니다. CTRL+9 or CMD+9 이번엔, 숨겼던 셀을 다시 보이게 해볼까요? SHIFT+CTRL+9 or SHIFT+CMD+9 이미 숨겨져 있던 셀을 다시 보이게 하고 싶을 때, 해당 셀을 선택할 수 없으시죠? 이럴 땐, 보이고 싶은 셀을 포함한 상태로 주위 셀을 선택하고 단축키를 사용하시면 됩니다. 열 숨기기/보이기 다음으로, 열을 숨겨 보겠습니다. 마찬가지로 숨기고 싶은 열을 선택하고,.. 2021. 1. 19.