>> > import pandas as pd
>> > df= pd. read_csv( 'dataAnalyst_sql_utf.csv' )
>> > df= pd. read_csv( 'dataAnalyst_sql.csv' , encoding= 'gbk' )
>> > df. head( )
>> > df. tail( )
positionId city companyId firstType secondType education industryField positionAdvantage positionName positionLables salary workYear 5026 2582910 北京 3786 开发/测试/运维类 数据开发 本科 移动互联网,金融 大牛团队,互联网金融,零食水果,灵活工时 BI数据分析师 ['数据分析', '数据', 'BI', '分析师', '商业智能'] 15k-25k 3-5年 5027 2583183 北京 59239 开发/测试/运维类 软件开发 本科 金融 五险一金,年底奖金 大数据风控研发工程师 ['专家', '高级', '软件开发'] 15K-30K 3-5年 5028 1832950 北京 50702 技术 数据开发 本科 移动互联网,O2O 期权 高级数据技术专家 ['数据挖掘', '数据'] 30k-40k 5-10年 5029 2582349 北京 156832 市场/商务/销售类 销售 不限 金融 周末双休/高提成/每月员工趴 分析师助理/销售人员 ['顾问', '销售', '分析师'] 4k-6k 不限 5030 1757974 北京 1575 技术 高端技术职位 本科 移动互联网,数据服务 大公司,高福利,互联网数据团队,机会多 数据仓库建模工程师 ['数据仓库', '数据', '建模'] 15k-30k 不限
>> > df. info( )
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 5031 entries, 0 to 5030
Data columns (total 12 columns):
positionId 5031 non-null int64
city 5031 non-null object
companyId 5031 non-null int64
firstType 5027 non-null object
secondType 5028 non-null object
education 5031 non-null object
industryField 5031 non-null object
positionAdvantage 5031 non-null object
positionName 5031 non-null object
positionLables 5007 non-null object
salary 5031 non-null object
workYear 5031 non-null object
dtypes: int64(2), object(10)
memory usage: 471.7+ KB
>> > df. positionId= df. positionId. astype( 'str' )
>> > df[ [ 'city' , 'education' ] ]
city education 0 上海 硕士 1 上海 本科 2 上海 本科 3 上海 本科 4 上海 本科 5 上海 本科 ... ... ... 5027 北京 本科 5028 北京 本科 5029 北京 不限 5030 北京 本科
5031 rows × 2 columns
>> > df[ 'city' ]
0 上海
1 上海
2 上海
3 上海
4 上海
..
5028 北京
5029 北京
5030 北京
Name: city, Length: 5031, dtype: object
df[ 'new' ] = df. positionId+ df. companyId
df[ df. query( 'new>2000000' ) . city== '北京' ]
0 False
1 False
2 False
3 False
4 False
5 False
...
5016 False
5017 False
5018 False
5020 False
5021 False
5022 False
5023 False
5024 False
5026 True
5027 True
5029 True
Name: city, Length: 4011, dtype: bool