ZhangZhihui's Blog  

2022年4月14日

摘要: Note: For a POSIX-compliant solution, see this answer. ${BASH_SOURCE[0]} (or, more simply, $BASH_SOURCE[1] ) contains the (potentially relative) path 阅读全文
posted @ 2022-04-14 09:36 ZhangZhihuiAAA 阅读(93) 评论(0) 推荐(0)

2022年3月29日

摘要: pstree -ap <pid> [pkill will send the specified signal (by default SIGTERM) to each process instead of listing them on stdout.] [-P, --parent ppid,... 阅读全文
posted @ 2022-03-29 08:16 ZhangZhihuiAAA 阅读(56) 评论(0) 推荐(0)

2022年2月16日

摘要: Need to set xticks first, then set xticklabels. x = np.arange(len(df_pivot['tla'])) ax2.set_xticks(x) ax2.set_xticklabels(df_pivot['tla']) 阅读全文
posted @ 2022-02-16 23:02 ZhangZhihuiAAA 阅读(609) 评论(0) 推荐(0)
 
摘要: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until ex 阅读全文
posted @ 2022-02-16 16:19 ZhangZhihuiAAA 阅读(894) 评论(0) 推荐(0)
 
摘要: import base64 from datetime import date from io import BytesIO from matplotlib.ticker import MaxNLocator def fig_to_html(fig): """ Convert a matplotli 阅读全文
posted @ 2022-02-16 15:55 ZhangZhihuiAAA 阅读(51) 评论(0) 推荐(0)
 
摘要: fig_width = fig.get_figwidth() xmargin_ratio, ymargin_ratio = ax.margins() xmargin = fig_width * xmargin_ratio 阅读全文
posted @ 2022-02-16 14:15 ZhangZhihuiAAA 阅读(69) 评论(0) 推荐(0)

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 阅读(59) 评论(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 阅读(30) 评论(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 阅读(79) 评论(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 阅读(26) 评论(0) 推荐(0)