matplotlib使用过程中报错:matplotlib.category: Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.
解决示例:
import matplotlib.pyplot as plt import logging logging.basicConfig(level='INFO') mlogger = logging.getLogger('matplotlib') mlogger.setLevel(logging.WARNING) data = {'Monday': 154, 'Thursday': 153, 'Tuesday': 151, 'Sunday': 144, 'Wednesday': 139, 'Friday': 130, 'Saturday': 120} names = list(data.keys()) values = list(data.values()) fig, axs = plt.subplots(figsize=(9, 3)) axs.bar(names, values) plt.show()
or
plt.set_loglevel('WARNING')