目录xlrd.biffh.XLRDError: Excel xlsx file; not supported检验有哪些包字体问题报错UserWarning: color is redundantly defined by the ‘color’ keyword argument and the fmt string “m–” (- color‘m’). The keyword argument will take precedence.报错ValueError: cannot convert float NaN to integerxlrd.biffh.XLRDError: Excel xlsx file; not supportedengine‘openpyxl’importpandasaspdfrompymannkendallimportmk# Step 1: 读取Excel文件并准备数据file_pathpath/to/your/excel_file.xlsxdfpd.read_excel(file_path,sheet_namesheet_name,engineopenpyxl)# Step 2: 进行Mann-Kendall测试resultmk_test(df[Value])# Step 3: 解释结果trend上升ifresult.trendincreasingelse下降ifresult.trenddecreasingelse没有趋势is_significant是ifresult.p0.05else否print(f趋势方向{trend})print(f是否显著{is_significant})print(fMann-Kendall统计量{result.tau})print(fp-value{result.p})检验有哪些包import pymannkendallprint(dir(pymannkendall))字体问题UserWarning: Glyph 38388 (\N{CJK UNIFIED IDEOGRAPH-95F4}) missing from current font.FigureCanvasAgg.draw(self)**解决办法**这个错误是因为在图表中使用了不支持的字符 “\N{CJK UNIFIED IDEOGRAPH-95F4}”这通常发生在图表中包含了中文或其他特殊字符时。要解决这个问题我们需要修改代码使用支持中文字符的字体来绘制图表。在绘制图表之前我们需要指定一个支持中文字符的字体。例如我们可以使用Arial Unicode MS字体来支持中文字符。在matplotlib中可以通过以下代码设置全局的字体importmatplotlibasmpl mpl.rcParams[font.family][Arial Unicode MS,Arial]# 设置优先使用Arial Unicode MS字体如果没有该字体则使用Arial字体报错UserWarning: color is redundantly defined by the ‘color’ keyword argument and the fmt string “m–” (- color‘m’). The keyword argument will take precedence.plt.plot(x_lim,[conf_intveral[0],conf_intveral[0]],‘m–’,color‘r’,label‘95%显著区间’)这个警告是由于在plt.plot()函数中同时使用了color和fmt参数来定义线条的颜色。fmt参数是用于设置线条样式的字符串而color参数是用于设置线条颜色的关键字参数。由于两者都设置了颜色Python会发出一个警告并且color参数将优先生效。为了消除这个警告我们可以在plt.plot()函数中只使用fmt参数来定义线条的样式而不指定color参数。这样线条颜色将由fmt参数中的字符来确定。在原代码中设置了’m–‘作为样式字符串其中’m’表示品红色magenta’–表示虚线样式。我们可以将这部分修改为只设置样式而不指定颜色示例如下plt.plot(x_lim,[conf_intveral[0],conf_intveral[0]],--,label95%显著区间)plt.plot(x_lim,[conf_intveral[1],conf_intveral[1]],--)报错ValueError: cannot convert float NaN to integerTraceback (most recent call last):File “E:/daimabao/python/论文_作图包/标识掩膜.py”, line 62, inmask_files(input_folder, mask_folder, output_folder)File “E:/daimabao/python/论文_作图包/标识掩膜.py”, line 34, in mask_filesinput_array[mask_array 0] np.nanValueError: cannot convert float NaN to integer