logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

[转载] python3 格式化字符串 f-string 介绍

参考链接: Python | 字符串lower简介 f-string,亦称为格式化字符串常量(formatted string literals),是Python3.6新引入的一种字符串格式化方法,该方法源于PEP 498 – Literal String Interpolation,主要目的是使格式化字符串的操作更加简便。f-string在形式上是以 f 或 F 修饰符引领的字符串(f'xxx'

[转载] python自定义异常类型和raise抛出异常

参考链接: Python自定义异常实际开发中,有时候系统提供的异常类型不能满足开发的需求。这时候你可以通过创建一个新的异常类来拥有自己的异常。异常类继承自 Exception 类,可以直接继承,或者间接继承。1.自定义异常类型#1.用户自定义异常类型,只要该类继承了Exception类即可,至于类的主题内容用户自定义,可参考官方异常类class TooLongExceptin(Exception)

[转载] 使用神经网络和ml模型预测客户流失

参考链接: Keras中的深度学习模型-探索性数据分析(EDA)This story is a walk-through of a notebook I uploaded on Kaggle. Originally, it only used machine learning models and since then I have added a couple of basic neural n

[转载] python3 opencv 图像二值化笔记(cv2.adaptiveThreshold)

参考链接: python opencv 基础6: cv2.threshold()二值图像前一篇研究了opencv二值化方法threshold的使用,但是这个方法也存在一定的局限性,假如有一张图存在明显的明暗不同的区域,如下图可以看到左边部分因为整体偏暗,导致二值化后变成全黑,丢失了所有细节,这显然不是我们想要的结果。原因threshold函数使用一个阈值对图像进行二值化,导致小于这个阈值的像素点全

[转载] python中日期和时间格式化输出的方法

参考链接: Python程序将时间从12小时转换为24小时格式1.将字符串的时间转换为时间戳 方法: a = "2013-10-10 23:40:00" #将其转换为时间数组 import time timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S") #转换为时间戳: timeStamp = int(time.mktime(timeArray)) t

[转载] Python Pandas 的 all和any方法

参考链接: Python 中的any和all一、all方法DataFrame.all(axis=0, bool_only=None, skipna=True, level=None) 作用:返回是否所有元素都为真(可能在轴上)axis: 0或’index’;1或’columns’;None。默认为0。指出哪个轴应该减少。0或’index’:减少索引,返回索引为原始列标签的Series。1或’col

[转载] python 去除字符串的标点符号 用_Python成为专业人士笔记–String字符串方法

参考链接: Python的字符串Strings decode“专业人士笔记”系列目录:创帆云:Python成为专业人士笔记--强烈建议收藏!每日持续更新!​zhuanlan.zhihu.com更改字符串的大小写Python的字符串类型提供了许多作用于字符串大小写的函数。这些包括 :str.casefoldstr.upperstr.lowerstr.capitalizestr.titlestr.sw

[转载] python-numpy如何初始化数组值全为nan

参考链接: Python中的numpy.nan_to_numimport numpy as npdata = np.full((2, 2), np.nan)print(data) # [[nan nan] [nan nan]]

[转载] python计时函数timeit.timeit()使用小结

参考链接: Python中的Timeit与示例Python提供了一个timeit.timeit()函数用于计算函数的运行时间,这使得我们在项目开发中很方便的设计profiling并根据结果做相应的优化, 其定义如下:timeit.timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000)Create

[转载] 使用openpyxl模块向Excel中插入图片

参考链接: Python | 使用openpyxl模块在Excel工作表中绘制图表 2使用openpyxl模块向Excel中插入图片示例Python实现结果展示示例向一个Excel表格中A1位置插入一张图片。Python实现from openpyxl import load_workbookfrom openpyxl.drawing.image import Imagedef insertimg2

    共 28 条
  • 1
  • 2
  • 3
  • 请选择