|
|
|
@ -14,11 +14,13 @@ import pandas as pd
|
|
|
|
|
from collections import Counter
|
|
|
|
|
from openpyxl import Workbook
|
|
|
|
|
|
|
|
|
|
# 读取弹幕文件
|
|
|
|
|
def ReadXlsx(filePath=''):
|
|
|
|
|
df = pd.read_excel(filePath, sheet_name=0)
|
|
|
|
|
df.dropna(axis=1, how='all')
|
|
|
|
|
return df
|
|
|
|
|
|
|
|
|
|
# 将dataframe类型转为string类型
|
|
|
|
|
def ChangeDfToString(df,sep=',', isSave=False, filePath=''):
|
|
|
|
|
string_data = df.to_string(index=False, header=False, na_rep='')
|
|
|
|
|
string = string_data.replace('\n', ' ')
|
|
|
|
@ -28,6 +30,7 @@ def ChangeDfToString(df,sep=',', isSave=False, filePath=''):
|
|
|
|
|
file.write(str)
|
|
|
|
|
return str
|
|
|
|
|
|
|
|
|
|
# 根据关键词进行检索
|
|
|
|
|
def GetKeyFromList(keyWords, origin_list):
|
|
|
|
|
filtered_list = [item for item in origin_list if any(keyword in item for keyword in keyWords)]
|
|
|
|
|
counter_list = Counter(filtered_list)
|
|
|
|
|