CPP Skills
Compile
Compile file:
gcc {FileName} -o {outputFile}
Compile multi file:
If all the cpp file is in the same folder, use:
gcc *.cpp -o {outputFile}
If they are not under the same folder, try:
gcc {FileName1} {FileName2} ... {FileNameN} -o {outputFile}
Or writing a makefile is also a good c...
Description of The Result of Random Forests from sklearn
接下来是做随机森林,将参数导入,直接调用sklearn里面的RandomForestClassifier即可
df['species'] = pd.Categorical.from_codes(ydata, yname)
#print(df['species'])
df.head()
train, test = df[df['is_train']==True], df[df['is_train']==False]
features = df.columns[:100]
clf = RandomForestClassifier(n_jobs=2)
y, _ = pd.factorize(train['species'])
clf.fit(train[features], y)
pre...
Pandas:Boolean Operation of pandas
Don’t use not. Use ~
In [7]: s = pd.Series([True, True, False, True])
In [8]: ~s
Out[8]:
0 False
1 False
2 True
3 False
dtype: bool
Python:Read Multi Csv File as one dataFrame
import pandas as pd
import os
inputdir=r'C:\Users\数据\Desktop\新建文件夹'
df_empty=pd.DataFrame(columns=['名称','列1','列2'])
for parents, dirnames, filenames in os.walk(inputdir):
for filename in filenames:
df=pd.read_excel(os.path.join(parent,filename))
df_empty=df_empty.append(df,ignore_index=True)
Python:Read Multi Csv File as one dataFrame
import pandas as pd
import os
inputdir=r'C:\Users\数据\Desktop\新建文件夹'
df_empty=pd.DataFrame(columns=['名称','列1','列2'])
for parents, dirnames, filenames in os.walk(inputdir):
for filename in filenames:
df=pd.read_excel(os.path.join(parent,filename))
df_empty=df_empty.append(df,ignore_index=True)
Python:Split string with multi-operator
re模块的split()函数可以使用多个分隔符对句子进行分割,其中不同的分隔符要用 “
” 隔开。
import re
re.split('。|!|?',text)
Out[67]: ['你好', '吃早饭了吗', '再见', '']
VsCode replace all variables
全选目标变量名或函数名
光标左击选中某个变量,然后CTRL+Shift+L 选中所有的目标变量
替换
CTRL+F打开查找窗口,将窗口变成replace模式,下面第二行填入要替换成的名称。
右边的两个图标分别代表单一代替(配合上面的左右箭头使用)和全部代替
25 post articles, 4 pages.