df = df.drop_duplicates().reset_index(drop=True)
df2=df2.drop(cols,axis=1)
df.drop(index=[0, 1])
from datetime import datetime, date, time
d = date.fromisoformat('2018-09-22')
t = time.fromisoformat('16:28:22')
dt = datetime.fromisoformat('2018-09-22')
sdate = pd.to_datetime(ds).strftime('%Y-%m-%d')
st = "2019-01-20 00:00:00"
dt = datetime.datetime.strptime(st, '%Y-%m-%d %H:%M:%S')
st = "2019-01-20"
dt = datetime.datetime.strptime(st, '%Y-%m-%d')
start=pd.to_datetime('2017-01-01')
train['tf_status'] = t1['tf_status'].astype(np.int64)
df['ds'] = pd.to_datetime(df['ds'])
df.rename(columns={'#studentid':'studentid'}, inplace = True)
df['year']=df.datetime.apply(lambda x: x.year)
df['month'] = df.datetime.apply(lambda x: x.month)
df['year'] = df['year'].astype(np.int64)
df['month'] = df['month'].astype(np.int64)
df.drop([‘#id’], axis=1, inplace=True)
print(df.weeks.quantile(np.arange(.9,1,.01)))
df = df.set_index([‘hetongdetailid’])
print(“在 cat 列中总共有 %d 个空值.” % df[‘cat’].isnull().sum())
print(“在 review 列中总共有 %d 个空值.” % df[‘review’].isnull().sum())
df[df.isnull().values==True]
df = df[pd.notnull(df[‘review’])]
df.sort_values(by=“x1”,ascending= False)
df_remark_tf[df_remark_tf[“content_method”].str.contains(keystring)]
df_appraise[‘deptid’] = df_appraise[‘deptid’].astype(np.int64)
(https://blog.csdn.net/zhangchuang601/article/details/79583551)
df.loc[1,[‘name’,‘age’]] = [‘bb’,11]
df.iloc[1,2] = 19#修改某一无
df.loc[df[df.htid.isin(ids)].index,“y”]=1
df.to_sql(name=‘predict’,con=mysql_engine,if_exists = ‘replace’)
dt = datetime.datetime(year, month, 1)
print(movie_rating_count[‘totalRatingCount’].quantile(np.arange(.9,1,.01)))
#-------plotly.express-------------------------
import plotly.express as px
fig = px.line(df, x=‘date’, y=‘y_true’,
labels={‘date’:‘日期’, ‘y_true’:‘话务量’},
markers=True)
fig.update_xaxes(tickformat = “%Y-%m-%d”, hoverformat = “%Y-%m-%d”)
fig.update_layout(title_text=“热线部门日业务量趋势图”, title_x=0.5)
fig.update_traces(marker=dict(size=3)) #控制点的大小
fig.show()
fig = px.scatter(df, x=“真实订单量”, y=“真实金额”,hover_data=[‘did’,‘日期’])
fig.update_traces(marker=dict(size=4)) #点的大小
fig.show()
------------------更新pip命令----------------------------------------
python -m pip install --upgrade pip
如果升级失败,明明执行的就是pip升级命令,但是最后一句提示用一样的代码升级。其实是权限问题,小伙伴们按下面的代码升级即可!!!在代码后面加上 --user表示信任:
python-m pip install–upgrade pip --user
-------------搭建虚拟环境-----------------------------
conda create --name yourenvname python=3.8
conda activate yourenvname
conda deactivate
conda remove -n py39 --all
python -m ipykernel install --user --name yourenvname --display-name “display-name”
activate torch_env
回车
回车
右上角,new,即可选择需要的虚拟环境。
5.另外,如果需要在指定文件夹中打开jupyter notebook,只需要打开文件夹所在位置,点击搜索框左边的位置框,输入cmd,再输入jupyter notebook,即可将路径设为自己需要的。
jupyter kernelspec uninstall myenv
pip install package_name -i https://pypi.tuna.tsinghua.edu.cn/simple
例如 nohup jupyter notebook &
ps -ef | grep xxxx
ps -ef 查看本机所有的进程;grep xxxx代表过滤找到条件xxxx的项目
kill -9 具体的PID
-------------打开指定端口-------------------------------------
firewall-cmd --zone=public --add-port=8504/tcp --permanent
firewall-cmd --reload
netstat -ntlp //查看当前所有tcp端口·
netstat -ntulp |grep 8888 //查看所有1935端口使用情况