목록Python/Numpy | Pandas (10)
코딩하는 해맑은 거북이

해당 글은 특정 데이터 타입의 열만 가져올 수 있는 select_dtypes 함수를 소개한다. 📌 DataFrame.select_dtypes(include=None, exclude=None) pandas.DataFrame.select_dtypes — pandas 2.1.4 documentation To select Pandas datetimetz dtypes, use 'datetimetz' or 'datetime64[ns, tz]' pandas.pydata.org *예시 데이터 import pandas as pd df = pd.DataFrame({ 'col1': [1, 2, 3], 'col2': ['a', 'b', 'c'], 'col3': [1.1, 2.2, 3.3] }) df.info() 📌 DataF..

Pandas 를 공부할 때 혹은 다시 복습할 때, 좋은 자료가 있어 블로그에 남겨둔다. - Pandas 치트 시트 https://pandas.pydata.org/Pandas_Cheat_Sheet.pdf - 10분 안에 Pandas 공부하기 https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html 10 minutes to pandas — pandas 2.1.1 documentation 10 minutes to pandas This is a short introduction to pandas, geared mainly for new users. You can see more complex recipes in the Cookbook. Customa..

해당 글은 아래의 3가지를 다룬다. 📌 str.startswith(prefix) 📌 str.endswith(suffix) 📌 str.contains(substring) 📌 str.startswith(prefix) 주어진 접두어(prefix)로 시작하는지 여부를 확인하여 Boolean 타입으로 이루어진 데이터프레임을 반환한다. import pandas as pd import numpy as np # 샘플 데이터프레임 생성 df = pd.DataFrame({'과일이름': ['사과', '바나나', '포도', '키위', '블루베리', '라즈베리', '블랙베리', '골드키위'], '갯수': np.random.randint(1, 20, size=8)}) df df['과일이름'].str.startswith('골드')..

해당 글의 내용은 아래의 2개 주소의 내용에서 Pandas만 한번에 보기 쉽게 하기 위해 모은 것 입니다. 해당 글은 아래의 2가지를 다룬다. 1. Pandas I 🔹 pandas 🔹 Series 🔹 DataFrame 🔹 selection & drop 🔹 dataframe operations 🔹 lambda, map, apply 🔹 pandas built-in functions 2. Pandas II 🔹 Groupby I 🔹 Groupby II 🔹 Case Study 🔹 Pivot table & Crosstab 🔹 Merge & Concat 🔹 persistence 원본글 링크보기 ↓ 더보기 인공지능(AI) 기초 다지기 (8) 본 게시물의 내용은 '인공지능(AI) 기초 다지기(부스트코스)' 강의를 듣고 ..
해당 글은 array를 list로 변환하는 방법에 대해 알아본다. np.array(리스트) list를 array로 변환시키는 방법으로 np.array를 사용하였다. list1 = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]] array1 = np.array(list1) print(array1) [[0 1 2 3 4] [5 6 7 8 9]] ndarray.tolist() 반대로 array를 list로 변환시키는 방법으로 tolist() 함수를 이용한다. array2 = np.arange(10).reshape(2,5) list2 = array2.tolist() print(list2) [[0 1 2 3 4] [5 6 7 8 9]]
본 게시물의 내용은 'Numpy(부스트캠프 AI Tech)' 강의를 듣고 작성하였다. comparisons - All & Any : Array의 데이터 전부(and) 또는 일부(or)가 조건에 만족 여부 반환 a = np.arange(10) a array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) a 5), np.all(a 5), np.any(a < 0) # 하나라도 조건에 만족한다면 True (True, False) * numpy는 배열의..