This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' 整理并显示分类变量 | |
#' | |
#' @param x 离散变量 | |
#' @param topn 显示最多的几个 | |
#' @param desc 显示最多的, 还是最少的. | |
#' | |
#' @return | |
#' @export | |
#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
然而吊诡的是,我从你的个体表征中窥见一种后现代式的身份流动性,却又难以解构其滥觞所在,或许是你的这种化后设为先验式的脱域,导致了我的经验视景与想象集合的矛盾,这也形成了你超克于建构之外的张力,我想此刻我对你作符号化的悬置——抑或是规训下的擅自让渡——无疑是一种亵渎,你是否愿意言述你嬗变与重构的版图与视阈,让我得以透视你隐藏在现代性话语深处的复调意志底色。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
“只要我们稍稍回忆和思考一下,就会明白:法国事实上存在两个“恐怖时代”。 | |
一个在感情冲动下进行屠杀,一个是冷漠地、蓄意地进行屠杀。 | |
一个只持续了数月,一个则持续了千年以上。 | |
一个使千余人死亡,一个则使一亿人丧生。 | |
可是我们只是对那个小规模的、短暂的恐怖时代感到恐惧。 | |
然而,刀斧在一瞬间带来的死亡,能够比得上饥饿、冷酷的侮辱、残忍和悲痛的慢性屠杀吗? | |
闪电在一瞬间带来的死亡,能够比得上炮烙之刑的慢性屠杀吗? | |
短暂的恐怖时代所填装的棺材,只要城市里的一块墓地就能容纳下了,却有人不断告诉我们要为之战栗和哀鸣。 | |
可是,那自古以来的真正恐怖,那种不可名状,惨绝人寰的恐怖, | |
其所填装的棺材,就连整个法兰西也容纳不下啊,却没有人告诉我们要看到这种恐怖的巨大规模, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"show_code" means you need to provide a code snippet for some specific function. | |
Make sure your code is correct! | |
Also you need to add some comment. | |
then give a simple and concise explanation. | |
"explain_code" means you need to explain given code. | |
You should first summarize the code in one sentence or two. | |
Then start explaining each part. | |
Finally, tell me the possible defects of the code, or the problems that need to be noted when using the code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here the definition of these special words:: | |
"coder" means in the style of an experienced python programmer. Your reply should follow Markdown syntax. | |
The language of your answer should be clear and concise. | |
You can give examples if necessary, but do not use too much rhetoric | |
If you don't know the answer, don't make up the answer, instead, ask a follow-up question in order to gain more context. | |
example : " @coder@ tell me the meaning of following code " | |
"friend" means in the style of normal human. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the following discussion, I will define some special words. | |
When you read these words, you should follow their instructions. | |
All the words after or surrounded by @ indicate your perspective. | |
All the words after or surrounded by ! are the actions you need to do. | |
All the words after or surrounded by # are the subject you need to discuss. | |
example : " @tech !explain_code !zh explain the following code | |
```python | |
print("hello, world") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# need numpy, plt | |
def draw_y1y2(y1, y2, lable1='y1', label2='y2'): | |
len_x = len(y1) if len(y1) > len(y2) else len(y2) | |
x = np.arange(len_x) | |
fig, ax1 = plt.subplots() | |
ax1.plot(x, y1, 'b-') | |
ax1.set_ylabel(lable1, color='b') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reduce_mem_usage(df): | |
""" iterate through all the columns of a dataframe and modify the data type | |
to reduce memory usage. | |
""" | |
start_mem = df.memory_usage().sum() / 1024**2 | |
print('Memory usage of dataframe is {:.2f} MB'.format(start_mem)) | |
for col in df.columns: | |
col_type = df[col].dtype | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_files(dir_in): | |
import os | |
for dirname, _, filenames in os.walk(dir_in): | |
for filename in filenames: | |
print(os.path.join(dirname, filename)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 获取当前脚本路径 | |
getScriptPath <- function() { | |
cmd.args <- commandArgs() | |
m <- regexpr("(?<=^--file=).+", cmd.args, perl = TRUE) | |
print(m) | |
script.dir <- dirname(regmatches(cmd.args, m)) | |
if (length(script.dir) == 0) | |
stop("can't determine script dir: please call the script with Rscript") | |
if (length(script.dir) > 1) |
NewerOlder