首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏数据万花筒

    Python入门教程(六):Numpy计算之布尔运算

    = pd.read_csv('data/Seattle2014.csv')['PRCP'].values inches = rainfall / 254.0 # 1/10mm -> inches inches.shape 例如,可以写如下的复合表达式: np.sum((inches > 0.5) & (inches < 1)) # 29 我们可以看到降水量在0.5-1英寸间的天数是29天。 np.sum(~( (inches <= 0.5) | (inches >= 1) )) # 29 将比较运算符和布尔运算符合并起来用在数组上,可以实现更多有效的逻辑运算操作。 , np.sum(inches ! = 0)) print("Days with more than 0.5 inches:", np.sum(inches > 0.5)) print("Rainy days with < 0.2 inches

    5.1K20发布于 2020-12-30
  • 来自专栏Android技术分享

    Android开发Gradle高级技巧、自定义Gradle Task、打包完成自动签名、执行Shell脚本

    //两种设备的渠道打包 productFlavors { inches21 { buildConfigField("String", "INCHES_TYPE ", "\"21\"") } inches32 { buildConfigField("String", "INCHES_TYPE", "\"32 = project.rootDir.absolutePath + "/sign/iMx6-21/" def inches32Dir = project.rootDir.absolutePath ": wDir = inches21Dir shPath = inches21Dir + wDir = inches32Dir shPath = inches32Dir + "sign.sh"

    4.8K30发布于 2019-03-27
  • 来自专栏叶子陪你玩编程

    python 批量更换PPT logo 图片

    最终代码: from pptx import Presentation from pptx.util import Inches prs = Presentation("测试.pptx") img_path e = list(shape.element)[1] e.getparent().remove(e) left, top, width, height = Inches (1), Inches( 0.2), Inches(3), Inches(1) # 预设位置及大小 else: for shape in list(slide.shapes e = list(shape.element)[1] e.getparent().remove(e) left, top, width, height = Inches (10.5), Inches( 0.2), Inches(3), Inches(1) # 预设位置及大小 slide.shapes.add_picture(

    2.1K20发布于 2021-03-23
  • 来自专栏巴山学长

    带你玩转matlab单位换算

    相信不少小伙伴接触过figure这个函数,figure中有个属性就是units,有pixels、normalized、inches、centimeters、points等几种可选情况,不少小伙伴使用它的时候可能没有注意而直接使用了系统的默认设置 1 inches = 2.54 centimeters 1 inches = 4.62 normalized 1 inches = 72.0 points 1 inches = 96.0 pixels 所有可用type类型说明如下: 为了方便type类型书写,将五个单位分别进行缩写处理,inches缩写为in,centimeters缩写为ce,normalized缩写为no,points缩写为po,pixels 若要将inches转换成points,type则写成 'in2po',意为"inches to points"。 所有可用type: inches到其他:in2in, in2ce, in2no, in2po, in2pi centimeters到其他:ce2ce, ce2in, ce2no, ce2po, ce2pi

    2.4K20编辑于 2023-03-17
  • 来自专栏实用技术

    python自动化系列之python操作pptx文件

    写操作1、初始化ppt:from pptx import Presentation from pptx.util import Inches,Pt ppt = Presentation()2、插入ppt ppt.save('python.pptx')完整代码:```def create():'''创建ppt'''from pptx import Presentationfrom pptx.util import Inches (3.2),top=Inches(2),width=Inches(3.5),height=Inches(5)) # 插入图片#------------------##---------------- (2),top=Inches(2),width=Inches(5),height=Inches(2)).table # 插入表格table.columns[0].width = Inches(2) # 设置第0列的宽度table.columns[1].width = Inches(3) # 设置第1列的宽度#添加内容table.cell(0,0).text = 'ppt'table.cell(

    3K40编辑于 2022-07-22
  • 来自专栏python3

    python-pptx的基本使用

    (1), Inches(4.5), Inches(2), Inches(2)   # 预设位置及大小 pic= slide.shapes.add_picture(img_path, left, top, (1), Inches(3), Inches(1.8), Inches(1)   # 预设位置及大小 shape= slide.shapes.add_shape(MSO_SHAPE.PENTAGON,   height)   # 在指定位置按预设值添加类型为PENTAGON的形状 shape.text= 'Step 1' forninrange(2, 6):     left= left+width-Inches (3.5), Inches(4.5), Inches(6), Inches(0.8) table= slide.shapes.add_table(rows, cols, left, top, width , height).table  # 添加表格,并取表格类 table.columns[0].width= Inches(2.0)   # 第一纵列宽度 table.columns[1].width= 

    3.9K20发布于 2020-01-08
  • 来自专栏一行数据

    学会Python自动制作PPT,立马在兼职群接到一单

    # 新增文本框 from pptx.util import Inches left= top= width= height= Inches(3) # 预设位置及大小 textbox = slide.shapes.add_textbox from pptx.util import Inches # 新增图片 img_path= '杨超越_1.jpeg' # 文件路径 left, top, width, height= Inches(3) , Inches(4.5), Inches(2), Inches(2) # 预设位置及大小 pic= slide.shapes.add_picture(img_path, left, top, width rows, cols, left, top, width, height = 2,2,Inches(3.5), Inches(4.5), Inches(6), Inches(0.8) table= slide.shapes.add_table (rows, cols, left, top, width, height).table # 添加表格,并取表格类 table.columns[0].width=Inches(2.0) # 第一纵列宽度

    2.4K20发布于 2020-07-14
  • 来自专栏信数据得永生

    数据科学 IPython 笔记本 9.8 比较,掩码和布尔逻辑

    例如,我们可以像这样解决这种复合问题: np.sum((inches > 0.5) & (inches < 1)) # 29 所以我们看到有 29 天的降雨量在 0.5 到 1.0 英寸之间。 请注意,此处的括号很重要 - 由于运算符优先级规则,删除了括号,此表达式将按如下方式计算,这会导致错误: inches > (0.5 & inches) < 1 使用A AND B和NOT (NOT A OR NOT B)的等价性(如果你已经参加了逻辑入门课程,你可能还记得),我们可以用不同的方式计算相同的结果: np.sum(~( (inches <= 0.5) | (inches >= 1) )) = 0)) print("Days with more than 0.5 inches:", np.sum(inches > 0.5)) print("Rainy days with < 0.2 inches (inches[summer])) print("Maximum precip on summer days in 2014 (inches): ", np.max(inches[summer

    1.6K10编辑于 2022-12-02
  • 来自专栏清晨我上码

    6-比较掩码布尔

    /data/Seattle2014.csv')['PRCP'].values inches = rainfall / 254.0 # 1/10mm -> inches inches.shape ## = rainfall / 254.0 # 1/10mm -> inches ...: inches.shape Out[58]: (365,) # 计算降雨量在0.5到1的天数 In [61 ]: ...: np.sum((inches > 0.5) & (inches < 1)) Out[61]: 29 运算符等效ufunc运算符等效ufunc & np.bitwise_and with < 0.2 inches :", np.sum((inches > 0) & ...: than 0.5 inches: 37 Rainy days with < 0.2 inches : 75 布尔数组作为掩码参与数组运算 在上面,我们研究了直接在布尔数组上计算的聚合。

    1.9K00发布于 2020-03-19
  • 来自专栏Python小屋

    Python批量导入图片生成PowerPoint 2007+文件

    import os import pptx from pptx.util import Inches pptFile = pptx.Presentation() picFiles = [fn for fn ')] # 导入并为当前幻灯片添加图片,起始位置和尺寸可修改 slide.shapes.add_picture(fn, Inches(0), Inches(0), Inches(10), Inches(7.5)) pptFile.save('第三章.pptx') 附:代码截图 ?

    2.4K30发布于 2018-04-16
  • 来自专栏python爱好部落

    用python来通过PPT开卷考试

    1 # 新段落的级别 add_paragraph中的文字支持修改font pptx.util 中为Pt为文字大小设置 4.添加新文本框 left = top = width = height = Inches (1), Inches(4.5), Inches(2), Inches(2) # 预设位置及大小 pic = slide.shapes.add_picture(img_path, left, top, (1), Inches(3), Inches(1.8), Inches(1) # 预设位置及大小 shape = slide.shapes.add_shape(MSO_SHAPE.PENTAGON, left (3.5), Inches(4.5), Inches(6), Inches(0.8) table = slide.shapes.add_table(rows, cols, left, top, width , height).table # 添加表格,并取表格类 table.columns[0].width = Inches(2.0) # 第一纵列宽度 table.columns[1].width = Inches

    1.4K20发布于 2021-11-16
  • 来自专栏跟牛老师一起学WEBGIS

    Openlayers2唯一值渲染

    true} } ); map.addLayers([tiled]); OpenLayers.INCHES_PER_UNIT ["千米"] = OpenLayers.INCHES_PER_UNIT["km"]; OpenLayers.INCHES_PER_UNIT["米"] = OpenLayers.INCHES_PER_UNIT ["m"]; OpenLayers.INCHES_PER_UNIT["英里"] = OpenLayers.INCHES_PER_UNIT["mi"]; OpenLayers.INCHES_PER_UNIT ["英寸"] = OpenLayers.INCHES_PER_UNIT["ft"]; //比例尺 map.addControl(new OpenLayers.Control.ScaleLine

    1K20发布于 2018-10-23
  • 来自专栏Python七号

    Python 自动化办公-玩转 PPT

    以下代码添加一个圆角矩形形状,一英寸见方,并放置在距幻灯片左上角一英寸处: from pptx.enum.shapes import MSO_SHAPE from pptx.util import Inches placeholder.insert_picture('my-image.png') 如果要插入表格: from pptx import Presentation from pptx.util import Inches (2.0) width = Inches(6.0) height = Inches(0.8) table = shapes.add_table(rows, cols, left, top, width , height).table # set column widths table.columns[0].width = Inches(2.0) table.columns[1].width = Inches (2), Inches(2), Inches(6), Inches(4.5) slide.shapes.add_chart( XL_CHART_TYPE.COLUMN_CLUSTERED, x,

    2.7K20发布于 2021-08-19
  • 来自专栏跟牛老师一起学WEBGIS

    openlayers2渐变色渲染

    true} } ); map.addLayers([tiled]); OpenLayers.INCHES_PER_UNIT ["千米"] = OpenLayers.INCHES_PER_UNIT["km"]; OpenLayers.INCHES_PER_UNIT["米"] = OpenLayers.INCHES_PER_UNIT ["m"]; OpenLayers.INCHES_PER_UNIT["英里"] = OpenLayers.INCHES_PER_UNIT["mi"]; OpenLayers.INCHES_PER_UNIT ["英寸"] = OpenLayers.INCHES_PER_UNIT["ft"]; //比例尺 map.addControl(new OpenLayers.Control.ScaleLine

    2.8K20发布于 2018-10-23
  • 来自专栏编程教程

    用Python轻松打造专业PPT:自动化生成演示文稿全攻略

    示例2:自定义文本框若布局无占位符,或需自由定位文本,可手动添加文本框:python1from pptx import Presentation2from pptx.util import Inches (1)11top = Inches(2)12width = Inches(6)13height = Inches(1)14textbox = slide.shapes.add_textbox(left, (1)11top = Inches(1.5)12width = Inches(4)13height = Inches(3)14slide.shapes.add_picture(img_path, left 通过Inches()单位控制尺寸,1英寸≈2.54厘米。2.3 添加图表:数据可视化python-pptx支持柱状图、折线图等多种图表类型。生成图表需两步:定义数据源,添加图表到幻灯片。 (1), Inches(1.5), Inches(6), Inches(4)18chart = slide.shapes.add_chart(19 XL_CHART_TYPE.COLUMN_CLUSTERED

    2.7K10编辑于 2025-11-06
  • 来自专栏前端开发

    python-pptx 中 placeholder 和 shape 有什么区别?

    以下是一个完整的代码示例,展示了如何使用 placeholder 和 shape:from pptx import Presentationfrom pptx.util import Inches# 创建一个空的 slide.placeholders[1] # 第二个占位符是正文内容content_placeholder.text = "这是正文占位符中的文本"# 在幻灯片上添加一个额外的形状(矩形)left = Inches (1)top = Inches(2)width = Inches(3)height = Inches(1)shape = slide.shapes.add_shape( 1, left, top, 这段代码展示了如何根据动态数据生成报告:from pptx import Presentationfrom pptx.util import Inches# 创建一个 PowerPoint 演示文稿prs (1)top = Inches(1.5)width = Inches(6)height = Inches(1)textbox = slide.shapes.add_textbox(left, top,

    71210编辑于 2025-07-23
  • 来自专栏数据科学学习手札

    (数据科学学习手札82)基于geopandas的空间数据分析——geoplot篇(上)

    ='tight', pad_inches=0, dpi=300) ?    ='tight', pad_inches=0, dpi=300) ?    ='tight', pad_inches=0, dpi=300) ?    ='tight', pad_inches=0, dpi=300) ? ='tight', pad_inches=0, dpi=300) ?

    2.9K20发布于 2020-05-07
  • 来自专栏TechBlog

    SciencePlots 基本语法及特点

    ='tight',dpi=600) plt.savefig('\第2章 绘制工具及其重要特征\图2-3-8 SciencePlots_science.pdf', bbox_inches ='tight',dpi=600) plt.savefig('\第2章 绘制工具及其重要特征\图2-3-8 SciencePlots_ieee.pdf', bbox_inches=' ='tight',dpi=600) plt.savefig('\第2章 绘制工具及其重要特征\图2-3-8 SciencePlots_nature.pdf', bbox_inches ='tight',dpi=600) plt.savefig('\第2章 绘制工具及其重要特征\图2-3-8 SciencePlots_vibrant.pdf', bbox_inches ='tight',dpi=600) plt.savefig('\第2章 绘制工具及其重要特征\图2-3-8 SciencePlots_bright.pdf', bbox_inches

    1K30编辑于 2023-10-13
  • 来自专栏红色石头的机器学习之路

    开源!100 页机器学习教程全面开放,附完整代码

    /Illustrations/linear-regression-' + fit[count] + '.eps', format='eps', dpi=1000, bbox_inches = 'tight ', pad_inches = 0) fig1.savefig('../.. /Illustrations/linear-regression-' + fit[count] + '.pdf', format='pdf', dpi=1000, bbox_inches = 'tight ', pad_inches = 0) fig1.savefig('../.. /Illustrations/linear-regression-' + fit[count] + '.png', dpi=1000, bbox_inches = 'tight', pad_inches

    49710编辑于 2022-01-12
  • 来自专栏好奇心Log

    Python在线DEM地形图库harmonica

    df.lat lon=df.lon z=df.z df.z.plot.contourf() plt.savefig('F:/Rpython/lp36/plot103.1.1.png',dpi=800,bbox_inches ='tight',pad_inches=0) plt.show() # 画图 region=[-180,180,-90,90] proj=ccrs.PlateCarree() fig=plt.figure ='tight',pad_inches=0) plt.show() import os import xarray as xr import numpy as np import cartopy.crs df.title) ax.coastlines() ax.gridlines() plt.savefig('F:/Rpython/lp36/plot103.1.3.png',dpi=800,bbox_inches ='tight',pad_inches=0) plt.show()

    1.6K20发布于 2021-10-26
领券