Skip to content

Commit c9caaa8

Browse files
committed
Merge branch 'master' of https://github.com/JustDoPython/python-examples into master
2 parents da26903 + a2266c4 commit c9caaa8

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

fans/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Python 代码实例
2+
3+
Python技术 公众号文章代码库
4+
5+
6+
关注公众号:python技术,回复"python"一起学习交流
7+
8+
![](http://favorites.ren/assets/images/python.jpg)
9+
10+
11+
## 实例代码
12+
13+
[高效办公,pandas美化表格实例演示](https://github.com/JustDoPython/python-examples/tree/master/fans/beautyPandas):高效办公,pandas美化表格实例演示
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+

fans/beautyPandas/beautyp.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import pandas as pd
2+
from datetime import datetime,timedelta
3+
4+
5+
df2 = pd.read_excel("C:/sf3/sf3/excel/1170_07-28.xlsx",sheet_name="邵阳")
6+
7+
new = df2.set_index(pd.to_datetime(df2['最后上线时间']))
8+
new.index.name = 'last'
9+
new.sort_values('最后上线时间', ascending=True,inplace=True)
10+
11+
new['设备类型'] = new['设备别名'].str.split('0').str[0].str.split(' ').str[0]
12+
new2 = new.groupby(['设备类型','最后上线时间','设备别名','连接状态','所属监测点'],as_index=False)
13+
14+
new3 = new2.all()
15+
now = datetime.now().strftime('%Y-%m-%d')
16+
sevenDaysAgo = (datetime.now() + timedelta(days=-7)).strftime('%Y-%m-%d')
17+
new3.style.highlight_between(left=sevenDaysAgo,right=now,subset=['最后上线时间'],props='font-weight:bold;color:rgb(64, 158, 255)')\
18+
.highlight_between(left='普适型声光报警器',right='普适型声光报警器',subset=['设备类型'],props='background:#c7f5fe')\
19+
.highlight_between(left='普适型声光报警器',right='声光报警器',subset=['设备类型'],props='background:#c7f5fe')\
20+
.highlight_between(left='普适型GNSS基准站',right='普适型GNSS基准站',subset=['设备类型'],props='background:#ffa5a5')\
21+
.highlight_between(left='普适型GNSS基站',right='普适型GNSS基站',subset=['设备类型'],props='background:#ffa5a5')\
22+
.highlight_between(left='普适型GNSS监测站',right='普适型GNSS监测站',subset=['设备类型'],props='background:#a1eafb')\
23+
.highlight_between(left='普适型裂缝计',right='普适型裂缝计',subset=['设备类型'],props='background:#a6e3e9')\
24+
.highlight_between(left='普适型雨量计',right='普适型雨量计',subset=['设备类型'],props='background:#71c9ce')\
25+
.highlight_between(left='在线',right='在线',subset=['连接状态'],props='background:#f9ed69')\
26+
.highlight_between(left='普适型变形桩',right='普适型变形桩',subset=['设备类型'],props='background:#cbf1f5')

zhouluobo/honglou/红楼关系.rar

-849 KB
Binary file not shown.

0 commit comments

Comments
 (0)