일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- if
- awk
- mysql
- 배열
- postgresql
- SSH
- dataframe
- pandas
- FIND
- conda
- expect
- pi
- Unity
- Eclipse
- List
- python
- sqlite
- ngui
- with
- null
- SVN
- c++11
- DROP
- Shader
- 쉘
- autovacuum
- sql
- boost
- ubuntu
- C++
- Today
- Total
목록pandas (11)
その先にあるもの…
psycopg2를 사용하여 쿼리를 가져오면 table을 columns 이름들이 없이 데이터만 받아온다. import pandas as pd ... df = pd.read_sql( 'select * from table' , con = conn) conn.close()
DataFrame.droplevel(self, level, axis=0) Return DataFrame with requested index / column level(s) removed. >>> df = pd.DataFrame([ ... [1, 2, 3, 4], ... [5, 6, 7, 8], ... [9, 10, 11, 12] ... ]).set_index([0, 1]).rename_axis(['a', 'b']) >>> df.columns = pd.MultiIndex.from_tuples([ ... ('c', 'e'), ('d', 'f') ... ], names=['level_1', 'level_2']) level_1 c d level_2 e f a b 1 2 3 4 5 6 7 8 9 10 11 12..
dataframe.merge( table1, table2 ) - inner join dataframe.merge( table1, table2, how='outer' ) - outer join1(키 값이 한쪽에만 있어도 데이터를 보여준다) dataframe.merge( table1, table2, how='left' ) dataframe.merge( table1, table2, how='right' ) dataframe.merge( table1, table2, on='column' ) //기준열의 이름이 두 테이블에서 다르다면 기준열을 명시한다. dataframe.merge( table1, table2, left_on='column', right_on='column' ) //데이터 열이 아닌 인덱스를 기준..
dataframe을 출력할 때 행이나 열이 많으면 ... 으로 생략되는데 출력을 조정하는 옵션이 있다. import pandas as pd pd.set_option('display.max_row', 500) pd.set_option('display.max_columns', 100) pandas.pydata.org/pandas-docs/version/0.23/generated/pandas.set_option.html
출처: https://rfriend.tistory.com/450 [R, Python 분석과 프로그래밍의 친구 (by R Friend)] [Python pandas] DataFrame, Series의 행, 열 개수 세기 이번 포스팅에서는 Python pandas의 DataFrame, Series 의 행, 열의 개수를 세는 방법(how to count the number of rows and columns of pandas DataFrame and Series)을 소개하겠습니다. 간단한 것들이고, 이미.. rfriend.tistory.com 이번 포스팅에서는 Python pandas의 DataFrame, Series 의 행, 열의 개수를 세는 방법(how to count the number of rows a..
x1 x2 x3 x4 0 1 11 111 12 1 2 22 222 13 2 3 33 333 14 # 열(column) 삭제 del df['x1'] # axis = 1 세로 축 df = df.drop( 'x2', 1 ) df = df.drop( ['x3','x4'] , 1 ) # 행(row) 삭제 # 1번행 삭제 df = df.drop( 1, 0 ) # axis = 0 가로 축 # 0-,2번행 삭제 df = df.drop( [0,2], 0 )