摘要:
groupby是Pandas用于根据给定列中的不同值对数据点(即行)进行分组,分组后的数据可以计算生成组的聚合值。 agg 聚合操作 聚合操作是groupby后非常常见的操作,聚合操作可以用来求和、均值、最大值、最小值等. 函数 用途 函数 用途 min 最小值 max 最大值 sum 求和 mea 阅读全文
摘要:
import re content = [] srt = [] with open('input.vtt','r') as open_file: for lines in open_file: lines = lines.replace('WEBVTT','') #删除WEBVTT # vtt文件中 阅读全文
摘要:
In Python, a decorator is a design pattern that allows you to modify the functionality of a function by wrapping it in another function. The outer fun 阅读全文
摘要:
def counter(list): c_dict = {} for i in list: if i in c_dict: c_dict[i] += 1 else: c_dict[i] = 1 return c_dict def entropy(x): counts = counter(x) #每个 阅读全文