Skip to content

Commit

Permalink
Merge branch 'update'
Browse files Browse the repository at this point in the history
  • Loading branch information
djccnt15 committed Oct 14, 2024
2 parents 57b6899 + b286434 commit e71ae39
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 4 deletions.
14 changes: 14 additions & 0 deletions docs/blog/posts/2022-11-11-troubleshooting_pip.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ SQLAlchemy (1.3.10)
pip list --format=columns
```

## Fatal error in launcher

pip 명령어 입력 시 아래와 같은 에러만 뜨고 실행이 되지 않는 경우가 있다.

```
Fatal error in launcher: Unable to create process using
```

가상환경 경로가 바뀌거나 하는 문제로 발생하는데, 아래와 같이 pip를 재설치해주면 해결된다.

```
python -m pip install --upgrade --force-reinstall pip
```

---
## Reference
- [There was an error checking the latest version of pip](https://stackoverflow.com/questions/72439001/there-was-an-error-checking-the-latest-version-of-pip)
Expand Down
102 changes: 102 additions & 0 deletions docs/blog/posts/2024-10-13-git_commit_message.md
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)
94 changes: 94 additions & 0 deletions docs/blog/posts/2024-10-14-python_nan.md
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)
1 change: 1 addition & 0 deletions docs/pages/favorites.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ search:
- :simple-opencv: [OpenCV 이미지 확인하기](../blog/posts/2023-12-24-visualize_image.md)
- :material-play-network: [서버에서 프로그램 실행하는 방법](../blog/posts/2024-01-15-start_program.md)
- :material-microsoft-visual-studio-code: [VS Code 주요 단축키](../blog/posts/2024-09-30-vscode_shortcut.md)
- :simple-git: [Git 커밋 메세지 수정 방법](../blog/posts/2024-10-13-git_commit_message.md)

</div>
8 changes: 4 additions & 4 deletions docs/portfolio/board.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ sequenceDiagram
Client ->> FastAPI: API request
activate FastAPI
alt if cached data
FastAPI -->> Cache Server: check data
Cache Server --) FastAPI: response data
FastAPI -->> Cache Server: check data
Cache Server --) FastAPI: response data
else if not cached data
FastAPI -->> Database: query
Database --) FastAPI: result
FastAPI -->> Database: query
Database --) FastAPI: result
end
FastAPI --) Client: response
deactivate FastAPI
Expand Down

0 comments on commit e71ae39

Please sign in to comment.