본문 바로가기

Programming66

pandas에서 주의할점. np.where과 섞어쓰지 말자 만약 df 가 위와같이 생긴 pandas 테이블이라면 id1 = np.where(df['A']=='8c1b.....6fa') 이라고하면 id1[0] 은 [0,1,2,3 ... ] 을 담고있다. df의 첫째 행을 0으로 잡고 새로 count 한 index id2 = df.index[df['A']=='8c1b.....6fa'].tolist() 을 하면 id2 는 [0, 406, 2412 ... ] 을 담고 있다. df 내에 포함하고 있는 index값 df을 loc,으로 indexing할때는 id2 기준으로 동작한다. iloc로 인덱싱하면 id1기준으로 동작. df.loc[id1[0]]으로 해도 에러나지 않고 동작함으로 버그 발생활 확률이 높다. 2019. 7. 9.
[python] argparse 구문 jupyter 에서 사용하기 argparse는 python3에 기본적으로 들어있는 pytyhon input variable 처리 라이브러리다. 사용법> def main(): # Training settings parser = argparse.ArgumentParser(description='PyTorch MNIST Example') parser.add_argument('--batch-size', type=int, default=64, metavar='N', help='input batch size for training (default: 64)') parser.add_argument('--test-batch-size', type=int, default=1000, metavar='N', help='input batch size for.. 2019. 5. 27.
VScode에 jupyter notebook, ipython 사용하기 https://code.visualstudio.com/docs/python/jupyter-support Working with Jupyter Notebooks in Visual Studio Code Working with Jupyter Notebooks in Visual Studio Code code.visualstudio.com 파이썬 고르기 Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P). Connect to a remote Jupyter server You can offload intensive computation in a Jupyter notebook to other computers by connecting .. 2019. 5. 16.
[python] python, 32bit, 64bit 확인 >>> import platform >>> print(platform.architecture()) 2019. 4. 1.