python查看列的唯一值方法

yipeiwu_com6年前
查看某一列中有多少中取值: 数据集名.drop_duplicates(['列名']) #实际为删除重复项,删除后对原数据集不修改 输入:data.drop_duplicates(['na...

Python操作word常见方法示例【win32com与docx模块】

yipeiwu_com6年前
本文实例讲述了Python操作word常见方法。分享给大家供大家参考,具体如下: 这里介绍两种方式: 使用win32com 使用docx 1. 使用win32com扩展包 只...

Python 字符串转换为整形和浮点类型的方法

yipeiwu_com6年前
Python2.6 之前:字符串转换为整形和浮点型 >>>import string >>>string.atoi('34.1') 34 &...

python3.x 将byte转成字符串的方法

yipeiwu_com6年前
如下所示: result = str(要转换的变量名, encoding='utf-8') 例如: result = str(request, encoding='utf-8'...

python把数组中的数字每行打印3个并保存在文档中的方法

yipeiwu_com6年前
python把数组中的数字每行打印3个并保存在文档中的方法
如下所示: arrs=[2,15,48,4,5,6,7,6,4,1,2,3,6,6,7,4,6,8] f=open('test.txt','w+') count=0 for temp...

Python计算开方、立方、圆周率,精确到小数点后任意位的方法

yipeiwu_com6年前
Python计算开方、立方、圆周率,精确到小数点后任意位的方法
Python计算的位数 在电脑上做了一个实验,看看python能计算到多少位,一下是结果。 x = math.sqrt((3)) print ("%.53f"%(x)) print...

python 实现对数据集的归一化的方法(0-1之间)

yipeiwu_com6年前
多数情况下,需要对数据集进行归一化处理,再对数据进行分析 #首先,引入两个库 ,numpy,sklearn from sklearn.preprocessing import Mi...

python 将print输出的内容保存到txt文件中

yipeiwu_com6年前
具体代码如下所示: import sys import os class Logger(object): def __init__(self, filename="Default...

解决Python3中的中文字符编码的问题

yipeiwu_com6年前
解决Python3中的中文字符编码的问题
python3中str默认为Unicode的编码格式 Unicode是一32位编码格式,不适合用来传输和存储,所以必须转换成utf-8,gbk等等 所以在Python3中必须将str类型...

python调用tcpdump抓包过滤的方法

yipeiwu_com6年前
python调用tcpdump抓包过滤的方法
本文实例为大家分享了python调用tcpdump抓包过滤的具体代码,供大家参考,具体内容如下 之前在linux用python脚本写一个抓包分析小工具,实在不想用什么libpcap、py...