zoukankan      html  css  js  c++  java
  • pandas

    df = reviews.loc[:99,['country','variety']] or df = reviews.loc[[1,2,3,4],['country','variety']]
    df = reviews.loc[[0,1,10,100],['country','province','region_1','region_2']] 两颜色不能互换,必须index在前
    iloc index loc lable
    top_oceania_wines = reviews.loc[reviews.country.isin(['Australia', 'New Zealand']))&(reviews.points >= 95)]

    top_oceania_wines = reviews[reviews.country.isin(['Australia', 'New Zealand'])&(reviews.points>=95)] #no using of loc
    Use the unique function to get a list of unique entries in a column.
    countries = reviews.country.unique() returns ##array
    countries = reviews.country.drop_duplicates() #returns series 
    ser1 = pd.Series([1, 2, 3, 4, 5])
    ser2 = pd.Series([4, 5, 6, 7, 8])
    
    ser1[~ser1.isin(ser2)]
    ser1[ser1.isin(ser2)]
    ser1.isin(ser2)
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- focus on what you want to be
  • 相关阅读:
    第07组 Alpha冲刺(2/4)
    第07组 Alpha冲刺(1/4)
    团队项目-需求分析报告
    团队项目-选题报告
    1381 硬币游戏
    1381 硬币游戏
    1347 旋转字符串
    1344 走格子
    1305 Pairwise Sum and Divide
    1384 全排列
  • 原文地址:https://www.cnblogs.com/bamboozone/p/10589605.html
Copyright © 2011-2022 走看看