第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

【九月打卡】第13天 Python辦公自動化

標(biāo)簽:
Python

课程名称Python办公自动化

课程章节:第6章 玩转PPT自动化

课程讲师: 离岛


课程内容


https://img1.sycdn.imooc.com//6327260a0001376109640447.jpg

本次实战课包含了前面介绍的添加文字、图表等内容。


https://img1.sycdn.imooc.com//63273233000105f605090374.jpg

import pptx
from pptx.util import Inches,Pt
from pptx.enum.shapes import MSO_SHAPE
from pptx.dml.color import  RGBColor
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE
from pptx.enum.chart import XL_LEGEND_POSITION

prs=pptx.Presentation()
#第一页
slide1=prs.slides.add_slide(prs.slide_layouts[0])
slide1.shapes.title.text='4S店汽车消费者洞察报告'
slide1.shapes.placeholders[1].text='2020年第一季度'

https://img1.sycdn.imooc.com//63273264000168c505220373.jpg

#第二页
slide2=prs.slides.add_slide(prs.slide_layouts[1])
slide2.shapes.title.text='目录'
content=slide2.shapes.placeholders[1].text_frame
content.add_paragraph().text='4S店第一季度汽车销售榜单'
content.add_paragraph().text='汽车用户消费偏好趋势'
content.add_paragraph().text='汽车消费者用户画像'

https://img1.sycdn.imooc.com//6327328a0001ab9c04920387.jpg

#第三页
slide3=prs.slides.add_slide(prs.slide_layouts[1])
slide3.shapes.title.text='4S店第一季度汽车销售榜单'
table=slide3.shapes.add_table(11,4,Inches(0),Inches(1.4),Inches(10),Inches(6)).table
#写入内容
table.cell(0,0).text='排名'
table.cell(0,1).text='车型'
table.cell(0,2).text='所属厂商'
table.cell(0,3).text='一季度销售额'
data=[{'type':'日产轩逸','base':'东风日产','total':50000},
{'type':'大众宝米','base':'一汽大众','total':46401},
{'type':'吉利帝豪','base':'吉利汽车','total':43400},
{'type':'奥迪A6','base':'一汽大众','total':41000},
{'type':'大众速腾','base':'一汽大众','total':40000},
{'type':'本田雅阁','base':'广汽本田','total':39800},
{'type':'奔驰C级','base':'北京奔驰','total':357000},
{'type':'长安逸动','base':'长安汽车','total':34000},
{'type':'宝马5系','base':'华晨宝马','total':22000},
{'type':'奥迪A4L','base':'一汽大众','total':21000}]
for i in range(11):
    if i>0:
        table.cell(i,0).text=str(i)
        table.cell(i, 1).text =data[i-1]['type']
        table.cell(i, 2).text =data[i-1]['base']
        table.cell(i, 3).text = str(data[i-1]['total'])


https://img1.sycdn.imooc.com//632732b200014e8604830351.jpg

#第四页
slide4=prs.slides.add_slide(prs.slide_layouts[1])
slide4.shapes.title.text='汽车用户消费偏好趋势'
shape1=slide4.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(1),Inches(1.5),Inches(3),Inches(2.5))
fill=shape1.fill
fill.solid()
fill.fore_color.rgb=RGBColor(51,102,255)
shape1.text_frame.add_paragraph().text='价位偏好:'
p1=shape1.text_frame.add_paragraph()
p1.text='经济入门型'
p1.font.size=Pt(35)
shape2=slide4.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(4),Inches(1.5),Inches(4),Inches(2.5))
shape2.text_frame.add_paragraph().text='国别偏好:'
p2=shape2.text_frame.add_paragraph()
p2.text='国产自主品牌'
p2.font.size=Pt(35)
shape3=slide4.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(1),Inches(4),Inches(8),Inches(2.5))
fill=shape3.fill
fill.solid()
fill.fore_color.rgb=RGBColor(112,219,255)
shape3.text_frame.add_paragraph().text='车型偏好:'
p3=shape3.text_frame.add_paragraph()
p3.text='SUV车型仍为主力'
p3.font.size=Pt(35)


https://img1.sycdn.imooc.com//6327337e000188ec05070388.jpg

#第五页
slide5=prs.slides.add_slide(prs.slide_layouts[1])
slide5.shapes.title.text='汽车消费者用户画像'
chart_data=CategoryChartData()
chart_data.categories=['70后','80后','90后']
chart_data.add_series('各年龄段平均购车花费',(40,45,25))
slide5.shapes.add_chart(
    XL_CHART_TYPE.COLUMN_CLUSTERED,Inches(1),Inches(2.5),Inches(4),Inches(3),chart_data
)
chart_data1=CategoryChartData()
chart_data1.categories=['男','女']
chart_data1.add_series('性别分布',(65,35))
chart=slide5.shapes.add_chart(
    XL_CHART_TYPE.PIE,Inches(6),Inches(2.5),Inches(3),Inches(3),chart_data
).chart
chart.has_legend=True
chart.legend.position=XL_LEGEND_POSITION.RIGHT

https://img1.sycdn.imooc.com//632734e00001ea1404670339.jpg



#第六页
slide6=prs.slides.add_slide(prs.slide_layouts[0])
slide6.shapes.title.text='谢谢'
prs.save('test1.pptx')


课程收获
作者:ninjaes
链接:http://idcbgp.cn/article/329926
来源:慕课网


點擊查看更多內(nèi)容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消