
Python
小白学Python
Cyril_KI
LLM、图神经网络、社交网络挖掘、负荷预测、联邦学习
展开
-
python中使用dict给list.index加速
python中使用dict给list.index加速原创 2023-04-07 21:49:22 · 672 阅读 · 0 评论 -
python中将带有重复值的列表映射到字典
python中将带有重复值的列表映射到字典原创 2022-11-01 20:26:55 · 571 阅读 · 1 评论 -
Python统计数组中多个区间内的频数并画直方图
Python统计数组中多个区间内的频数并画直方图原创 2022-08-07 13:15:14 · 9963 阅读 · 0 评论 -
PyEMD中的残余量分析
PyEMD中的残余量分析原创 2022-04-23 21:14:54 · 3423 阅读 · 17 评论 -
python列表[[]] * n的一些坑
python列表[[]] * n的一些坑原创 2022-03-23 12:29:51 · 1931 阅读 · 0 评论 -
使用EEMD时报错:TypeError: ‘module‘ object is not callable
卸载重新安装!原创 2022-03-16 20:40:00 · 1854 阅读 · 1 评论 -
AttributeError: module ‘torch.nn.parameter‘ has no attribute ‘UninitializedParameter‘
AttributeError: module ‘torch.nn.parameter‘ has no attribute ‘UninitializedParameter‘原创 2022-01-17 21:12:23 · 1316 阅读 · 0 评论 -
RuntimeError: CUDA out of memory. Tried to allocate 1.54 GiB...
RuntimeError: CUDA out of memory. Tried to allocate 1.54 GiB...原创 2022-01-14 22:03:57 · 1454 阅读 · 0 评论 -
make_interp_spline(x, y[1:151])(x_smooth) ValueError: x and y are incompatible.
make_interp_spline(x, y[1:151])(x_smooth) ValueError: x and y are incompatible.原创 2022-01-19 11:29:12 · 1744 阅读 · 3 评论 -
networkx设置labels大小和颜色
font_size和font_color属性原创 2021-12-21 12:34:47 · 6723 阅读 · 0 评论 -
Python处理Les Misérables network并利用networkx画图
Python处理Les Misérables network并利用networkx画图原创 2021-12-16 11:58:05 · 4842 阅读 · 0 评论 -
torch加载optimizer时报错:KeyError: ‘optimizer‘
torch加载optimizer时报错:KeyError: 'optimizer'原创 2021-12-15 22:29:23 · 5957 阅读 · 0 评论 -
dataframe将字符串列按照类别映射为数字列
dataframe将字符串列按照类别映射为数字列原创 2021-11-28 22:48:45 · 1645 阅读 · 0 评论 -
DataFrame按照时间分组然后求平均
DataFrame按照时间分组然后求平均。原创 2021-11-22 22:48:11 · 7175 阅读 · 3 评论 -
plt设置坐标轴的刻度间隔
坐标轴的刻度间隔设置问题。原创 2021-11-03 20:39:05 · 19312 阅读 · 2 评论 -
SyntaxError: name ‘MAX‘ is assigned to before global declaration
main函数中修改全局变量时不需要使用global。原创 2021-08-15 20:41:55 · 12619 阅读 · 0 评论 -
com.chaquo.python.PyException: ValueError: Did not recognise loaded array layout
使用joblib的dump写入模型时应该注意加上compress参数。原创 2021-03-03 21:23:27 · 40356 阅读 · 1 评论 -
python初始化二维列表:[].append([]) 与 [[]] * n
[[]] * n执行lis[i].append(x)时会默认向每一个列表中都加入x。原创 2021-01-20 14:19:04 · 4218 阅读 · 3 评论 -
dataframe在最左边添加一列索引
df.insert(0, 'index', range(len(df)), allow_duplicates=False)0表示放在第0列,range(len(df))为数据,allow_duplicates=False不允许列名重复。原创 2021-01-18 22:10:43 · 6187 阅读 · 0 评论 -
DataFrame按照行(列)转成List
1、每一行为一个元素res = df.values.tolist()2、每一列为一个元素columns = df.columnsres = []for c in columns: d = df[c].values.tolist() res.append(d)原创 2020-09-27 18:06:33 · 113089 阅读 · 1 评论 -
使用torchvision时报错:ModuleNotFoundError: No module named ‘six‘
Anaconda Powershell Prompt中直接输入pip install six原创 2020-08-21 18:56:18 · 94450 阅读 · 0 评论 -
for batch_idx, (batch_x, batch_y) in enumerate(test_loader)报错:can‘t pickle module objects
报错信息如下:Traceback (most recent call last): File "E:/Program Files/PyCharm 2019.2/machinelearning/homework/CNN.py", line 151, in <module> train() File "E:/Program Files/PyCharm 2019.2/machinelearning/homework/CNN.py", line 140, in train fo原创 2020-08-18 23:19:48 · 92474 阅读 · 1 评论 -
python合并列表以及函数内部使用全局变量的一些坑
在写agnes算法时,需要合并列表,另外也在函数里使用了全局变量,碰到了一些问题,记录下来方便复习查阅。原创 2020-08-10 11:23:24 · 85862 阅读 · 0 评论 -
python利用pandas读取.data文件并对nan进行处理
在数据挖掘的很多领域,数据内容往往以.data形式给出,因此读取data文件到矩阵中并对异常值进行处理就变得很重要了。原创 2020-08-01 17:10:19 · 96728 阅读 · 2 评论 -
安装xgboost后仍报错:cannot import name ‘XGBRegressor‘ from ‘xgboost‘
报错如下:原因:我的py文件名也叫xgboost,Python在编译时把xgboost.py当成了一个module,自然在这个"module"里是找不到XGBRegressor的。解决方案:重命名py文件。原创 2020-07-28 21:01:13 · 89848 阅读 · 4 评论 -
Python读取有空行的txt文件+将内容分割保存到列表中
Python处理有空行的txt文件,将每一个单词(单词不包含空格)切割并存进列表当中。原创 2020-07-26 22:03:52 · 89426 阅读 · 0 评论