小编hga*_*ger的帖子

在 Python 脚本中无法连接本地数据库的 Firebird

我可以使用 Firebird ISQL 工具 (Firebird 3.0.4) 通过以下命令连接到我的 Firebird 数据库: connect "C:\Documents\database.db" user 'USER' password 'PASSWORD';

当我想在Python脚本(Windows10 64位上的Python v3.7.7)中,在包括fdb v2.0.1甚至firebirdsql v1.1.3的虚拟环境中执行此操作时,我不能并且系统地得到一个错误。

import fdb
con = fdb.connect(database="C:\Documents\database.db", user='USER' password='PASSWORD'')
Run Code Online (Sandbox Code Playgroud)

DatabaseError: ('连接到数据库时出错:\n- SQLCODE: -902\n- 无法完成对主机“xnet://Global\FIREBIRD”的网络请求。', -902, 335544721)

或者

con = fdb.connect(host='localhost', database="D:\Documents\database.db", user= 'USER' password= 'PASSWORD'')
Run Code Online (Sandbox Code Playgroud)

DatabaseError: ('连接到数据库时出错:\n- SQLCODE: -902\n- 无法完成对主机“localhost”的网络请求。\n- 无法建立连接。', -902, 335544721)

或者

con = fdb.connect(dsn="localhost:C:\Documents\database.db", user='USER' password='PASSWORD'')
Run Code Online (Sandbox Code Playgroud)

DatabaseError: ('连接到数据库时出错:\n- SQLCODE: -902\n- 无法完成对主机“localhost”的网络请求。\n- 无法建立连接。', -902, 335544721)

或者

import firebirdsql
con = firebirdsql.connect(host='localhost', database="D:\Documents\database.db", user='USER' password='PASSWORD'')
Run Code Online (Sandbox Code Playgroud)

如果您有任何想法,欢迎您,因为我被困住了。

python firebird fdb

2
推荐指数
1
解决办法
4482
查看次数

如何像R语言一样在热图单元格上添加交叉(X)?

我想在热图单元格上添加交叉(X)(取决于显着性水平,但问题在于添加 X)。

就像在 R 语言中一样(sig.level = XXX)。

请参阅使用的 Python 和 R 代码以及相应的输出图像。

感谢您的帮助。

# Draw the heatmap with the mask and correct aspect ratio
sns.heatmap(corr, mask=mask, cmap=cmap, center=0, vmin=-1, vmax=1, square=True, linewidths=0.5, fmt=".2f",
            cbar_kws={"shrink": .65, "orientation": "horizontal", "ticks":np.arange(-1, 1+1, 0.2)}, 
            annot = True, annot_kws={"weight": 'bold', "size":15})




corrplot(cor(subset (wqw, select = 
                       c(fixed.acidity:quality,ratio.sulfur.dioxide))),
         # compute the p matrix
         p.mat = cor.mtest(subset 
            (wqw, select = c(fixed.acidity:quality,ratio.sulfur.dioxide))), 
         # significance level 0.01
         sig.level = 0.01, 
         # Method to display : color (could be corcle, ...) …
Run Code Online (Sandbox Code Playgroud)

python matplotlib heatmap seaborn

1
推荐指数
1
解决办法
666
查看次数

标签 统计

python ×2

fdb ×1

firebird ×1

heatmap ×1

matplotlib ×1

seaborn ×1