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
2022. 7. 17. 18:52
Dataframe Join
2019. 11. 4. 16:10
# 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
2019. 9. 25. 15:36
./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개발환경 구축하기
2019. 9. 25. 10:35
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