Python
i-LucAs
这个作者很懒,什么都没留下…
展开
-
pandas Dataframe 显示行列不全(已解决)
#设置整体宽度pd.set_option('display.width', 1000)#显示所有列pd.set_option('display.max_columns', None)#显示所有行pd.set_option('display.max_rows', None)#单位列的显示长度,默认为50pd.set_option('max_colwidth',100)原创 2021-07-29 10:29:06 · 360 阅读 · 0 评论 -
tensorflow2.版本更新导致的1.x的问题
import tensorflow as tftf.reset_default_graph()module ‘tensorflow’ has no attribute ‘reset_default_graph’tf.reset_default_graph()修改为tf.compat.v1.reset_default_graph()module ‘tensorflow’ has no attribute ‘placeholder’tf.placeholder修改为tf.compa...原创 2021-07-10 18:07:01 · 901 阅读 · 0 评论 -
matplotlib.pyplot plt.hist() 绘制概率图时,概率和不为1的问题(已解决)
数据是10,000个随机投掷的骰子uni_data = np.random.randint(1, 7, 10000)直方图直接用density=1,y轴的概率值是不对的方法一:用bins修正,同时修正了x刻度对不齐的问题plt.hist(uni_data,bins=np.arange(0.5, 7.5), edgecolor='w',density=1) 方法二:给bins增加权重(参考)weights = np.ones_like(uni_data )/float(len(uni_原创 2021-04-24 17:24:54 · 3781 阅读 · 0 评论 -
matplotlib.pyplot plt.hist()画直方图时x坐标刻度和图不对齐的问题(已解决)
我的数据是随机投掷10,000次骰子uni_data = np.random.randint(1, 7, 10000)画直方图plt.hist(uni_data,edgecolor='w',density=1)plt.show()tcl柱子和图对不齐,解决:修改bins和x范围plt.hist(uni_data,bins=np.arange(0.5,7.5), edgecolor='w',density=1) #这里的6是plt.xlim(0,6)plt.show()ps:(0.5原创 2021-04-24 16:58:29 · 7748 阅读 · 0 评论 -
在cmd终端输入python弹出Windows应用商店(已解决)
直接Cortana搜索“管理应用执行别名”关闭有关python的“应用安装程序”原创 2021-03-13 11:33:33 · 1742 阅读 · 1 评论 -
anaconda更换清华源
打开.condarc (路径:C:\Users\Administrator)修改内容为:channels: - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64 - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64 - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-6原创 2021-04-08 14:31:09 · 311 阅读 · 0 评论 -
压缩包安装fitter库,gbk编码错误解决方法
安装fitter库直接pip和conda install都安装不了(不知道为什么,反正找不到在https://pypi.tuna.tsinghua.edu.cn/simple/fitter下载压缩包解压文件夹控制台cd到解压后的文件夹位置输入命令python setup.py install解决编码错误出现错误UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 3273: illega原创 2021-04-08 16:46:36 · 880 阅读 · 0 评论 -
python numpy定义矩阵行向量与列向量
import numpy as np# 定义行向量# Method1(直接定义)x1 = np.array([[-3/4,-1/4,-1/8]])print(x1)# Method2a = [[-3/4,-1/4,-1/8]]x2 = np.array(a)print(x2)# 定义列向量# Method1(直接定义)x3 = np.array([[-3/4],[-1/4],[-1/8]])print(x3)# Method2(利用行向量的Method1)x4 = x1.原创 2020-12-11 09:59:43 · 3817 阅读 · 0 评论