Notice
Recent Posts
Recent Comments
Link
목록2025/02/13 (1)
아미(아름다운미소)
np.select
import pandas as pdimport numpy as np# 샘플 DataFrame 생성df = pd.DataFrame({ "fruit": ["apple", "banana", "cherry", "date", "elderberry"], "quantity": [5, 3, 7, 2, 4], "price": [100, 50, 200, 30, 150]})# 조건 리스트 (여러 컬럼을 함께 비교)condlist = [ (df["fruit"] == "apple") & (df["quantity"] > 4), # "apple"이고 quantity가 4보다 큰 경우 (df["fruit"] == "banana") | (df["price"] = 150) # price가 150 이상인 경..
랭귀지/pandas
2025. 2. 13. 12:25