Python绘制柱形图
%%time
import psycopg2
import psycopg2.extras
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import datetime
"""用于解决matplotlib无法显示中文问题"""
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
pd.set_option('display.max_columns',200)
""""""
import warnings
warnings.filterwarnings("ignore")
def postgresql_cnn_7days(sql,days):
sql = sql
days = days
test = 0
cur = []
conn = psycopg2.connect(dbname = 'postgres',host = '127.0.0.1',user = 'postgres',password = 'puhonglin918',port = 5432)
cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
date_start = str(datetime.date.isoformat(datetime.date(2020,2,11)- datetime.timedelta(days = days)))
dat