import re, os
from collections import Counter
import pandas as pd
import matplotlib.pyplot as plt
from wordcloud import WordCloud
from PIL import Image
import numpy as np
# # 读取文档
# df = pd.read_excel('data.xlsx')
# print(df.head())
# # 输出列名
# print(df.columns)
# # 输出列长度
# print(len(df.columns))
# 读取文档
def read_document(file_path, start_line=None, end_line=None):
if file_path.endswith('.xlsx'):
df = pd.read_excel(file_path)
# 读取指定列
df = pd.read_excel(file_path, usecols='I:CG')#读取I列到CG列
return ' '.join(df.astype(str).values.flatten())
else:
with open(file_path, 'rb') as file:
lines = file.read().decode('utf-8-sig', errors='ignore').splitlines()
if start_line is not None and
文档散+词云图
最新推荐文章于 2025-08-24 11:50:19 发布