栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

pandas常用数据分析语法(三):查询

pandas常用数据分析语法(三):查询

pandas常用数据分析语法(三):查询
#列的频率统计
df_2018['Area ID'].value_counts().head(1).values[0]
筛选某些值
#相同
ChargeGroups_selected = ['Vehicle Theft', 'Robbery', 'Burglary', 'Receive Stolen Property']
#包含
df_6 = df_6.loc[df_6['Address'].str.contains('PICO')]

df_2018[df_2018['Charge Group Description'].isin(ChargeGroups_selected)]

#排除
df_4 = df_4[~df_4['Charge Group Description'].isin(excluded)]

#在范围内
df_6 = df_6.loc[(df_6['Lon']left1)]
分位数
Age.quantile(0.95)
排序
z_scores.abs().sort_values(ascending = False)
分组
df_4.groupby('Charge Group Description')['Age'].mean()
最大最小
op.idxmax()
op.max()
#位置
loca1 = df_6[df_6['Lat']==df_6['Lat'].max()].Location.head(1).values[0]
分列
mp = loca.split(',')
lon = float(mp[0][1:])
lat = float(mp[1][:-1])

df_6['Lon'] = df_6['Location'].str.split(',').str[0].str[1:]
apply
df_5.loc[:,'Location'] = df_5.loc[:,'Location'].apply(within_2km,args=(center,))
数据格式
df_6['Lon'] = df_6['Lon'].astype('float')

df_8['Arrest Date'].astype('str').str.split('-').str[0]
loc
df_8.loc[df_8.loc[:,'Arrest Type Code']=='F']
对bool用sum
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/742529.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号