我试图绘制我的实际时间序列值和预测值,但它给了我这个错误:
ValueError:视图限制最小值-36816.95989583333小于1并且是无效的Matplotlib日期值.如果将非日期时间值传递给具有日期时间单位的轴,则通常会发生这种情况
我正在使用statsmodels
适合数据的arima模型.
这是我的数据样本:
datetime value
2017-01-01 00:00:00 10.18
2017-01-01 00:15:00 10.2
2017-01-01 00:30:00 10.32
2017-01-01 00:45:00 10.16
2017-01-01 01:00:00 9.93
2017-01-01 01:15:00 9.77
2017-01-01 01:30:00 9.47
2017-01-01 01:45:00 9.08
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
mod = sm.tsa.statespace.SARIMAX(
subset,
order=(1, 1, 1),
seasonal_order=(1, 1, 1, 12),
enforce_stationarity=False,
enforce_invertibility=False
)
results = mod.fit()
pred_uc = results.get_forecast(steps=500)
pred_ci = pred_uc.conf_int(alpha = 0.05)
# Plot
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(1, 1, 1)
ax.plot(subset,color = "blue")
ax.plot(pred_uc.predicted_mean, color="black", alpha=0.5, label='SARIMAX')
plt.show()
Run Code Online (Sandbox Code Playgroud)
知道如何解决这个问题吗?
我尝试使用本地计算机上的 IAM 用户连接我的 Aurora Postgres 数据库,但出现以下错误:psql: FATAL: PAM authentication failed for user "test-rds"
在数据库上创建用户的命令:
CREATE USER test-rds WITH LOGIN;
GRANT rds_iam TO test-rds;
Run Code Online (Sandbox Code Playgroud)
我已创建此策略并将其附加到我的 IAM 用户。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:eu-west-1:$account:dbuser:$db-id/test-rds",
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
然后测试以下命令:
export PGPASSWORD=$(aws rds generate-db-auth-token --hostname $db-host --port $db-port --username test-rds --region eu-west-1)
psql "host=$db-host port=$db-port sslmode=require sslrootcert=rds-combined-ca-bundle.pem dbname=postgres user=test-rds"
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用 postgresql 用户,我可以访问我的数据库,但不能使用 iam 用户,我不明白为什么。
请帮助我^^!
我有一个带有布尔列的数据框,每个布尔列指示记录是否属于一个类别:
import pandas as pd
example = pd.DataFrame({
"is_a": [True, False, True, True],
"is_b": [False, False, False, True],
"is_c": [True, False, False, True],
})
Run Code Online (Sandbox Code Playgroud)
例:
is_a is_b is_c
0 True False True
1 False False False
2 True False False
3 True True True
Run Code Online (Sandbox Code Playgroud)
我想计算每对类别之间同时出现的次数。我目前正在这样做:
is_a is_b is_c
0 True False True
1 False False False
2 True False False
3 True True True
Run Code Online (Sandbox Code Playgroud)
输出:
is_a is_b is_c
is_a 3 1 2
is_b 1 1 1
is_c 2 1 2 …
Run Code Online (Sandbox Code Playgroud) I'm fairly new to Rust and coming from Python there are some things that are done very differently. In Python, one can import a single function from a .py file by typing from foo import bar
, but I still haven't found any equivalent in Rust.
I have the following files:
.
??? main.rs
??? module.rs
Run Code Online (Sandbox Code Playgroud)
With the following contents:
mod module;
fn main() {
module::hello();
}
Run Code Online (Sandbox Code Playgroud)
pub fn hello() {
println!("Hello");
}
pub fn bye() {
println!("Bye"); …
Run Code Online (Sandbox Code Playgroud) 我在Windows 10计算机上使用Pipenv遇到麻烦。最初,尝试运行时出现超时错误,pipenv install <module>
并且按照此答案进行操作,因此我禁用了Windows Defender。
那摆脱了超时错误,然后它似乎已成功在〜/ .virtualenvs上安装了该软件包,但是在创建Pipfile.lock时出现了一个错误:
Adding flask to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
File "C:\Users\Edgar\AppData\Roaming\Python\Python36\site-packages\pipenv\utils.py", line 402, in resolve_deps
req_dir=req_dir
File "C:\Users\Edgar\AppData\Roaming\Python\Python36\site-packages\pipenv\utils.py", line 250, in actually_resolve_deps
req = Requirement.from_line(dep)
File "C:\Users\Edgar\AppData\Roaming\Python\Python36\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 704, in from_line
line, extras = _strip_extras(line)
TypeError: 'module' object is not callable
Run Code Online (Sandbox Code Playgroud)
我尝试安装requests
和flask
,结果相同。
python ×3
amazon-rds ×1
datetime ×1
import ×1
matplotlib ×1
module ×1
pandas ×1
pipenv ×1
pipfile ×1
postgresql ×1
rust ×1
statsmodels ×1
windows ×1