Skip to content

Commit 6d6eef3

Browse files
committed
上传代码
1 parent c9caaa8 commit 6d6eef3

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

qingxiangke/PandasSift/main.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pandas as pd
2+
3+
# df = pd.read_excel("C:\\Users\\张亚南\\Desktop\\数据测试.xlsx")
4+
df=pd.DataFrame({
5+
'团体保单号': ['BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202210443', 'BJG11202210443', 'BJG11202210443', 'BJG11202210443', 'BJG11202210443', 'BJG11202210443', 'BJG11202210443', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202210443', 'BJG11202210443', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263', 'BJG11202003263'],
6+
7+
'姓名': ['刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '刘玲', '卜琳琳', '齐静', '齐静', '齐静', '刘洋', '刘洋', '刘洋', '刘洋', '杨海舰', '杨海舰', '范晶晶', '范晶晶'],
8+
9+
'出险人证件号码': ['04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '04211972071536', '01061975060836', '01021973072519', '01021973072519', '01021973072519', '02831982063006', '02831982063006', '02831982063006', '02831982063006', '02221987062064', '02221987062064', '01041980070720', '01041980070720'],
10+
11+
'交易流水号': ['220102000542', '220102000565', '011100030X220102000671', '011100030X220102000671', '011100030X220102000671', '011100030X220102000671', '011100030X220102000671', '011100030X220104016042', '021100020A220111013035', '081100030A220105005676', '081100030A220105006493', '011100020A220117005278', '011100020A220117005278', '011100020A220117005278', '011100020A220117005278', '011100050Y220104008654', '011100050Y220104008655', '011100050Y220106008912', '011100050Y220106008914', '011100050Y220107000858', '011100050Y220107001477', '011100050Y220107012903', '011100050Y220107013093'],
12+
13+
'赔付金额': [0, 260.18, 57.67, 57.67, 57.67, 57.67, 57.67, 166.63, 0, 0, 231.09, 396.32, 396.32, 396.32, 396.32, 0, 35, 0, 35, 0, 272.9, 0, 188],
14+
15+
'事故日期': ['2022-01-02', '2022-01-02', '2021-01-02', '2022-01-02', '2021-01-02', '2021-01-02', '2022-01-02', '2020-01-04', '2022-01-11', '2022-01-05', '2020-01-05', '2022-01-17', '2022-01-17', '2022-01-17', '2022-01-17', '2022-01-04', '2022-01-04', '2022-01-06', '2022-01-06', '2022-01-07', '2022-01-07', '2022-01-07', '2022-01-07'],
16+
17+
'出院日期': ['2022-01-02', '', '2022-01-02', '', '2021-01-02', '', '', '2021-01-04', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '2022-01-07']
18+
})
19+
20+
# # “事故日期”列转换成时间类型
21+
# df['事故日期'] = pd.to_datetime(df['事故日期'])
22+
# df['出院日期'] = pd.to_datetime(df['出院日期'])
23+
24+
# # 提取2021年的数据
25+
# df = df[df['事故日期'].dt.year == 2021]
26+
27+
# # 提取身份证为04211972071536和年份为2022年的数据
28+
# df = df[(df['出险人证件号码']=='04211972071536')&(df['事故日期'].dt.year == 2022)]
29+
30+
# # 提取身份证为04211972071536,事故日期为2022年的数据,如果有出院日期按出险日期为准
31+
# df = df[((df['出险人证件号码']=='04211972071536')&(df['出院日期'].dt.year == 2022))|((df['出险人证件号码']=='04211972071536')&(df['事故日期'].dt.year == 2022))]
32+
33+
# print(df.dtypes)
34+
print(df)

qingxiangke/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ Python技术 公众号文章代码库
1111

1212
[网站神器](https://github.com/JustDoPython/python-examples/tree/master/qingxiangke/easyWeb) : 一个超简易网站搭建神器
1313

14-
[爬虫](https://github.com/JustDoPython/python-examples/tree/master/qingxiangke/Crawler) : 用爬虫代替工作的魅力
14+
[爬虫](https://github.com/JustDoPython/python-examples/tree/master/qingxiangke/Crawler) : 用爬虫代替工作的魅力
15+
16+
[pandas](https://github.com/JustDoPython/python-examples/tree/master/qingxiangke/PandasSift) : pandas的多条件筛选

0 commit comments

Comments
 (0)