Python
- Macro key driver 2022.07.17
- Dataframe Join 2019.11.04
- VIM Python 3 ์ง์ํ๋๋ก build 2019.09.25
- NeoVIM์ผ๋ก Python๊ฐ๋ฐํ๊ฒฝ ๊ตฌ์ถํ๊ธฐ 2019.09.25
Macro key driver
Dataframe Join
# left์ ์กด์ฌํ๋ Key๊ฐ ์๋ ๋ฐ์ดํฐ๋ง merge
df_merge_how_left = pd.merge(df_left, df_right, how='left', on='KEY')
# right์ ์กด์ฌํ๋ Key๊ฐ ์๋ ๋ฐ์ดํฐ๋ง merge
df_merge_how_right = pd.merge(df_left, df_right, how='right', on='KEY')
# left ๋ฐ right ์์ชฝ์ ์กด์ฌํ๋ Key๊ฐ ์๋ ๋ฐ์ดํฐ๋ง merge
df_merge_how_inner = pd.merge(df_left, df_right, how='inner', on='KEY')
# ์์ชฝ์ ์กด์ฌํ๋ ๋ชจ๋ Key๊ธฐ์ค merge
df_merge_how_outer = pd.merge(df_left, df_right, how='outer', on='KEY')
# ๊ฐ ๋ฐ์ดํฐ๊ฐ left, right ๋๋ ์์ชฝ์ ์ถ์ฒ์ธ์ง ํ์(_merge๋ ์ปฌ๋ผ์ ํ์)
pd.merge(df_left, df_right, how='outer', on='KEY', indicator=True)
#์์ชฝ์ ์ปฌ๋ผ๋ช
์ด ์ค๋ณต๋ ๋ _left๋ _right๋ฅผ ์ปฌ๋ผ๋ช
์ ์ถ๊ฐํจ
pd.merge(df_left_2, df_right_2, how='inner', on='KEY', suffixes=('_left', '_right'))
VIM Python 3 ์ง์ํ๋๋ก build
./configure --with-features=huge --enable-cscope --enable-multibyte --enable-python3interp --with-python3-config-dir=/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu --enable-fail-if-missing
make
sudo make install
Fisa Vim Config (http://fisadev.github.io/fisa-vim-config/)
sudo apt-get install curl vim exuberant-ctags git ack-grep
sudo pip install pep8 flake8 pyflakes isort yapf
mv ~/.vimrc ~/.vimrc.org
wget -O ~/.vimrc https://raw.github.com/fisadev/fisa-vim-config/master/.vimrc
NeoVIM์ผ๋ก Python๊ฐ๋ฐํ๊ฒฝ ๊ตฌ์ถํ๊ธฐ
1. Neovim์ ์ค์นํ๋ค.
2. Nvim์ fisa-dev๋ฅผ ์ค์ ํ๋ค.
Fisa-nvim-config by fisadev
This is my personal NeoVim configuration, built according to my personal preferences, without any justification to think it's the best possible vim configuration. If you like it, great! :) It's mainly oriented to python software development, but many of it
nvim.fisadev.com
3. coc-nvim (intellisense plugin)์ ์ค์นํ๋ค.
๊ฐ. Node.js์ค์น
curl -sL install-node.now.sh/lts | sudo bash
๋. Yarn ์ค์น
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
๋ค. VIM Plugin์ค์น
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
๋ผ. ~/.config/nvim/init.vim์ ์๋ ๋ด์ฉ ์ถ๊ฐ
call plug#begin('~/.config/nvim/plugged')
" Use release branch
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Or latest tag
Plug 'neoclide/coc.nvim', {'tag': '*', 'branch': 'release'}
" Or build from source code by use yarn: https://yarnpkg.com
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
call plug#end()
๋ง. nvim์คํํ coc ๋ชจ๋ ์ค์น
:CocInstall coc-json
:CocInstall coc-python
:CocInstall coc-pypl
๋ฐ. ./config/nvim/coc-settings.json ํ์ผ์ Python language server์ค์ ์ถ๊ฐ
{
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["go"]
},
"ccls": {
"command": "ccls",
"filetypes": ["c", "cpp", "objc", "objcpp"],
"rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
"initializationOptions": {
"cache": {
"directory": "/tmp/ccls"
}
}
},
"python": {
"command": "python",
"args": [
"-mpyls",
"-vv",
"--log-file",
"/tmp/lsp_python.log"
],
"trace.server": "verbose",
"filetypes": [
"python"
],
"settings": {
"pyls": {
"enable": true,
"trace": {
"server": "verbose"
},
"commandPath": "",
"configurationSources": [
"pycodestyle"
],
"plugins": {
"jedi_completion": {
"enabled": true
},
"jedi_hover": {
"enabled": true
},
"jedi_references": {
"enabled": true
},
"jedi_signature_help": {
"enabled": true
},
"jedi_symbols": {
"enabled": true,
"all_scopes": true
},
"mccabe": {
"enabled": true,
"threshold": 15
},
"preload": {
"enabled": true
},
"pycodestyle": {
"enabled": true
},
"pydocstyle": {
"enabled": false,
"match": "(?!test_).*\\.py",
"matchDir": "[^\\.].*"
},
"pyflakes": {
"enabled": true
},
"rope_completion": {
"enabled": true
},
"yapf": {
"enabled": true
}
}
}
}
}
}
}
4. nvim default editor์ค์
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
sudo update-alternatives --config vi
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
sudo $ update-alternatives --config vim
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60
sudo update-alternatives --config editor