ZhangZhihui's Blog  

2022年1月24日

摘要: def get_list_span(l: list): """ For list ['a', 'a', 'a', 'b', 'c', 'c', 'd', 'd', 'd', 'd'], its span list is [3, 0, 0, 1, 2, 0, 4, 0, 0, 0] . :param 阅读全文
posted @ 2022-01-24 11:53 ZhangZhihuiAAA 阅读(52) 评论(0) 推荐(0)
 
摘要: def get_dict_leaves_count(dic): """ If value of a key is a list, count all items in the list as leaves. :param dic: :return: """ if len(dic) == 0: ret 阅读全文
posted @ 2022-01-24 00:25 ZhangZhihuiAAA 阅读(22) 评论(0) 推荐(0)

2022年1月23日

摘要: def convert_sqlite_row_to_dict(row, n: int): """ Convert a single row of rows returned by a select query of sqlite3. :param row: :param n: The number 阅读全文
posted @ 2022-01-23 22:08 ZhangZhihuiAAA 阅读(72) 评论(0) 推荐(0)
 
摘要: def update_dict_cascade(dict_1, dict_2): """ Update dict_1 with dict_2 in a cascade manner. :param dict_1: The dict to be updated. :param dict_2: The 阅读全文
posted @ 2022-01-23 19:06 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)
 
摘要: 阅读全文
posted @ 2022-01-23 16:52 ZhangZhihuiAAA 阅读(19) 评论(0) 推荐(0)

2022年1月22日

摘要: 阅读全文
posted @ 2022-01-22 17:48 ZhangZhihuiAAA 阅读(61) 评论(0) 推荐(0)

2022年1月9日

摘要: The default is tight_layout. plt.subplots() plt.subplots(constrained_layout=True) constrained_layout can autoextend. 阅读全文
posted @ 2022-01-09 11:13 ZhangZhihuiAAA 阅读(71) 评论(0) 推荐(0)
 
摘要: for tick in ax2.get_xticklabels(): tick.set_rotation(45) tick.set_size(8) tick.set_ha('right') 阅读全文
posted @ 2022-01-09 10:40 ZhangZhihuiAAA 阅读(57) 评论(0) 推荐(0)

2022年1月8日

摘要: def axes_show_y_value(axes, x_data, y_data): for x, y in zip(x_data, y_data): axes.annotate(str(y), # this is the text (x, y), # these are the coordin 阅读全文
posted @ 2022-01-08 18:07 ZhangZhihuiAAA 阅读(54) 评论(0) 推荐(0)
 
摘要: Python code: import base64from io import BytesIOdef fig_to_html(fig): """ Convert a matplotlib.Figure object to html image source :param fig: :return: 阅读全文
posted @ 2022-01-08 16:32 ZhangZhihuiAAA 阅读(40) 评论(0) 推荐(0)