-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
215 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--- | ||
slug: git-commit-message | ||
title: Git 커밋 메세지 수정 | ||
date: | ||
created: 2024-10-13 | ||
description: > | ||
Git 커밋 메세지를 수정하는 방법 정리 | ||
categories: | ||
- SW Engineering | ||
tags: | ||
- git | ||
--- | ||
|
||
Git 커밋 메세지를 수정하는 방법 정리 | ||
|
||
<!-- more --> | ||
|
||
--- | ||
|
||
## commit 사용 | ||
|
||
아래와 같이 `commit` 명령어를 통해 가장 최근의 커밋 메세지를 변경할 수 있다. | ||
|
||
- commit 메세지 수정 | ||
|
||
```shell | ||
git commit --amend | ||
``` | ||
|
||
- 최근 커밋 날짜를 현재 날짜로 변경 | ||
|
||
```shell | ||
git commit --amend --no-edit --date=now | ||
``` | ||
|
||
- 최근 커밋 날짜를 원하는 날짜로 변경 | ||
|
||
```shell | ||
git commit --amend --no-edit --date="May 23 11:08:49 2022 +0900" | ||
``` | ||
|
||
## rebase 사용 | ||
|
||
여러 커밋 메세지를 수정하고 싶을 때는 아래와 같이 `rebase` 명령어를 활용해서 처리 가능하다. | ||
|
||
```shell | ||
git rebase -i HEAD~n | ||
``` | ||
|
||
실제 활용 방법은 아래와 같다. | ||
|
||
1. 명령어 입력 | ||
```shell | ||
git rebase -i HEAD~3 | ||
``` | ||
``` | ||
pick 643d4a9 update exception module mv add_handlers func to exception module from handlers module | ||
pick 3759b06 minor bugfix update tokenUrl in auth for swagger doc | ||
pick f90c6c6 update README | ||
|
||
# Rebase 229793a..f90c6c6 onto 229793a (3 commands) | ||
# | ||
# Commands: | ||
# p, pick <commit> = use commit | ||
# r, reword <commit> = use commit, but edit the commit message | ||
# e, edit <commit> = use commit, but stop for amending | ||
# s, squash <commit> = use commit, but meld into previous commit | ||
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous | ||
# commit's log message, unless -C is used, in which case | ||
# keep only this commit's message; -c is same as -C but | ||
# opens the editor | ||
# x, exec <command> = run command (the rest of the line) using shell | ||
# b, break = stop here (continue rebase later with 'git rebase --continue') | ||
# d, drop <commit> = remove commit | ||
# l, label <label> = label current HEAD with a name | ||
# t, reset <label> = reset HEAD to a label | ||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] | ||
# create a merge commit using the original merge commit's | ||
# message (or the oneline, if no original merge commit was | ||
# specified); use -c <commit> to reword the commit message | ||
# u, update-ref <ref> = track a placeholder for the <ref> to be updated | ||
# to this position in the new commits. The <ref> is | ||
# updated at the end of the rebase | ||
# | ||
# These lines can be re-ordered; they are executed from top to bottom. | ||
# | ||
# If you remove a line here THAT COMMIT WILL BE LOST. | ||
# | ||
# However, if you remove everything, the rebase will be aborted. | ||
# | ||
``` | ||
1. 변경하려는 각 커밋 메시지 앞의 `pick`을 `reword`로 변경 및 저장 | ||
``` | ||
pick 643d4a9 update exception module mv add_handlers func to exception module from handlers module | ||
pick 3759b06 minor bugfix update tokenUrl in auth for swagger doc | ||
reword f90c6c6 update README | ||
``` | ||
1. 결과 커밋 파일마다 새 커밋 메시지 입력하고 파일을 저장 | ||
|
||
--- | ||
## Reference | ||
- [GitHub Docs - 커밋 메시지 변경](https://docs.github.com/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
slug: not-a-number | ||
title: Python의 NaN | ||
date: | ||
created: 2024-10-14 | ||
description: > | ||
Python의 NaN 다루기 | ||
categories: | ||
- Python | ||
tags: | ||
- python | ||
- pandas | ||
--- | ||
|
||
Python의 NaN 다루기 | ||
|
||
<!-- more --> | ||
|
||
--- | ||
|
||
## NaN | ||
|
||
`NaN`은 **Not-A-Number**의 약자로, 숫자가 아닌 값들을 나타낸다. | ||
|
||
pandas로 데이터를 처리하다보면 은근히 `NaN`을 다룰 일이 많은데, 몇몇 라이브러리들이 제공하는 `NaN` 여부 검사용 함수들은 입력값이 `str`일 경우 에러를 발생시키기 때문에 Boolean 값을 반환하는 함수를 만들어보았다. | ||
|
||
```python | ||
def is_nan(x): | ||
return (x != x) | ||
``` | ||
|
||
!!! note | ||
pandas는 테이블 데이터를 읽을 때 빈 셀을 `np.nan`으로 처리하는데, 칼럼 타입은 문자열일 경우[^1]에 정상적으로 데이터를 처리하기 위해 `math.isnan()`, `np.isnan()`으로 `NaN` 여부를 검사하면 정상 데이터가 있을 때 에러가 발생한다. | ||
|
||
[^1]: 해당 셀에 입력되어야 하는 데이터 타입은 문자열일 경우 | ||
|
||
```python | ||
import math | ||
|
||
print(math.isnan("a")) | ||
``` | ||
``` | ||
Traceback (most recent call last): | ||
File "C:\projects\python311\main.py", line 3, in <module> | ||
print(math.isnan("a")) | ||
^^^^^^^^^^^^^^^ | ||
TypeError: must be real number, not str | ||
``` | ||
|
||
```python | ||
import math | ||
|
||
|
||
def is_nan(x): | ||
return x != x | ||
|
||
|
||
data = ["a", 1, 1.0, math.inf, math.nan, float("nan")] | ||
for d in data: | ||
print(repr(d), is_nan(d)) | ||
``` | ||
``` | ||
'a' False | ||
1 False | ||
1.0 False | ||
inf False | ||
nan True | ||
nan True | ||
``` | ||
|
||
!!! tip | ||
아래와 같이 `pandas.isna()` 함수를 통해 동일한 작업을 처리할 수도 있다. | ||
|
||
```python | ||
import math | ||
|
||
import pandas as pd | ||
|
||
data = ["a", 1, 1.0, math.inf, math.nan, float("nan")] | ||
for d in data: | ||
print(repr(d), pd.isna(d)) | ||
``` | ||
``` | ||
'a' False | ||
1 False | ||
1.0 False | ||
inf False | ||
nan True | ||
nan True | ||
``` | ||
|
||
--- | ||
## Reference | ||
- [how-to-check-for-nan-values](https://stackoverflow.com/questions/944700/how-to-check-for-nan-values) |
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
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