我在python 文档中看到了重新采样和同步两个时间序列的能力.我的问题更难,因为时间序列没有时间规律.我读了三个具有非确定性的日内时间戳的时间序列.但是,为了对这两个时间序列进行大多数分析(协方差,相关性等),我需要它们具有相同的长度.
在Matlab中,给定了三个ts1, ts2, ts3具有非确定性日内时间戳的时间序列,我可以通过说明来同步它们
[ts1, ts2] = synchronize(ts1, ts2, 'union');
[ts1, ts3] = synchronize(ts1, ts3, 'union');
[ts2, ts3] = synchronize(ts2, ts3, 'union');
Run Code Online (Sandbox Code Playgroud)
请注意,时间序列已经读入pandas DataFrame,因此我需要能够与已创建的DataFrames同步(并重新采样?).
我安装了芹菜和RabitMQ和花.我可以浏览到花港.我有以下简单的工作人员,我可以附加到芹菜和从python程序调用:
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 12 16:37:33 2015
@author: idf
"""
from celery import Celery
app = Celery('tasks', broker='amqp://guest@localhost//')
@app.task
def add(x, y):
return x + y
Run Code Online (Sandbox Code Playgroud)
这个程序称之为
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 12 16:40:16 2015
@author: idf
"""
from tasks import add
add.delay(36, 5)
Run Code Online (Sandbox Code Playgroud)
我这样开芹菜:
idf@DellInsp:~/Documents/Projects/python3$ celery -A tasks worker --loglevel=info
[2015-12-12 19:22:46,223: WARNING/MainProcess] /home/idf/anaconda3/lib/python3.5/site-packages/celery/apps/worker.py:161: CDeprecationWarning:
Starting from version 3.2 Celery will refuse to accept pickle by default. …Run Code Online (Sandbox Code Playgroud) 我对如何在dash. 如何将dropdown和 并datepicker排放在同一行?
html.Div(
[
html.Div(
[
dcc.Dropdown(id='dropdown',
options=[{'label': i, 'value': i} for i in all_options],
multi=False,
placeholder='Select Symbol...',
),
dcc.DatePickerSingle(
id='my-date-picker-single',
min_date_allowed=today,
max_date_allowed=today,
initial_visible_month=today,
date=today)
],
className='row'
),
]
),
Run Code Online (Sandbox Code Playgroud) python zurb-foundation skeleton-css-boilerplate plotly plotly-dash
我能够理解如何callbacks在工作dash-table-experiment,其中DataTable的部分app.layout = Div/Html layout。
但是如何创建这样callback的DataTable生成时间并且它不是静态布局的一部分?
def generate_table(tdf, max_rows=200):
return dt.DataTable(rows=tdf.to_dict('records'),
columns=tdf.columns,
row_selectable=True,
filterable=False,
sortable=False,
selected_row_indices=[],
id="datatable-gapminder"
)
Run Code Online (Sandbox Code Playgroud)
如果我说
@app.callback(
Output('datatable-gapminder', 'selected_row_indices'),
[Input('graph-gapminder', 'clickData')],
[State('datatable-gapminder', 'selected_row_indices')])
def update_selected_row_indices(clickData, selected_row_indices):
if clickData:
for point in clickData['points']:
if point['pointNumber'] in selected_row_indices:
selected_row_indices.remove(point['pointNumber'])
else:
selected_row_indices.append(point['pointNumber'])
return selected_row_indices
Run Code Online (Sandbox Code Playgroud)
我收到一个错误
Attempting to assign a callback to the
component with the id "datatable-gapminder" but no
components with id "datatable-gapminder" exist in the
app's layout.
Run Code Online (Sandbox Code Playgroud) 这一段代码报错:
template <class T>
void print_vector(vector<T>& v, string sep)
{
std::ostream_iterator<T> ostr_it(std::cout, sep) ;
std::copy(begin(v), end(v), ostr_it);
}
Run Code Online (Sandbox Code Playgroud)
main.cpp:17:30: 错误:没有匹配的构造函数来初始化 'std::ostream_iterator<float>' std::ostream_iterator<T> ostr_it(std::cout, sep);
我很困惑,因为如果我在模板函数之外执行此操作并直接输出向量,则不会出现错误:
vector<float> result(elements);
std::copy(begin(result), end(result), ostream_iterator<float>(cout, ", "));
Run Code Online (Sandbox Code Playgroud)
怎么了?我需要专门化每个模板函数吗?
我正在运行一个非常简单的python script:
from tftb.generators import amgauss, fmlin
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
C:\Users\Anaconda3\envs\tf_gpu\lib\site-packages\tftb-0.0.1-py3.6.egg\tftb\processing\affine.py in <module>
12
13 import numpy as np
---> 14 from matplotlib.mlab import find
15 from scipy.signal import hilbert
16 from scipy.optimize import brenth, newton
ImportError: cannot import name 'find'
Run Code Online (Sandbox Code Playgroud)
我相信find不再是>=3 的版本。我怎样才能在不降级的情况下解决这个问题Matplotlib?
我有一个function需要返回多个值的:
def max_dd(ser):
...
compute i,j,dd
return i,j,dd
Run Code Online (Sandbox Code Playgroud)
如果我有这样的代码调用这个函数并传入一个series:
date1, date2, dd = df.rolling(window).apply(max_dd)
Run Code Online (Sandbox Code Playgroud)
但是,我收到错误:
pandas.core.base.DataError: No numeric types to aggregate
Run Code Online (Sandbox Code Playgroud)
如果我从 中返回单个值max_dd,则一切都很好。如何从“”函数返回多个值apply?
我能够遵循这里几乎所有的指示
但是当我到达时
[idf@node1 graphite]$ cd /opt/graphite/webapp/graphite/
[idf@node1 graphite]$ sudo python manage.py syncdb
Could not import graphite.local_settings, using defaults!
/opt/graphite/webapp/graphite/settings.py:244: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
ImportError: No module named fields
[idf@node1 graphite]$
Run Code Online (Sandbox Code Playgroud)
不知道为什么我收到此错误?
我也试过这些说明,它大约挂在同一个地方
[idf@node1 graphite]$ sudo PYTHONPATH=/opt/graphite/webapp/ django-admin.py syncdb --settings=graphite.settings
/var/tmp/sclHwyLM6: line 8: PYTHONPATH=/opt/graphite/webapp/: No such file or directory …Run Code Online (Sandbox Code Playgroud) 我的数据如下DataFrame symbolData:
Open High Low Close Volume Ex-Dividend Split Ratio Adj. Open Adj. High Adj. Low Adj. Close Adj. Volume
Date
1980-12-12 28.75 28.8700 28.7500 28.75 2093900.0 0.0 1.0 0.424421 0.426193 0.424421 0.424421 117258400.0
Run Code Online (Sandbox Code Playgroud)
当我series在Adj Close列中获得时,我想给它起一个名字:
adjClose = symbolData.ix[:,10]
Run Code Online (Sandbox Code Playgroud)
现在,上面看起来像
Date
1980-12-12 0.424421
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像
AlgoClose
Date
1980-12-12 0.424421
Run Code Online (Sandbox Code Playgroud) 以管理员身份从 Windows Powershell 运行,我尝试了以下所有方法。什么都行不通。不仅如此,找到错误大约需要 20 分钟。
这是尝试创建项目的输出:
PS D:\Documents\js> create-react-app socket-io-client
Creating a new React app in D:\Documents\js\socket-io-client.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> uglifyjs-webpack-plugin@0.4.6 postinstall D:\Documents\js\socket-io-client\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
npm ERR! path D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rmdir
npm ERR! Error: EPERM: operation not permitted, rmdir 'D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules'
npm ERR! { Error: EPERM: operation …Run Code Online (Sandbox Code Playgroud) python ×5
pandas ×3
plotly-dash ×2
amqp ×1
c++ ×1
c++11 ×1
celery ×1
centos7 ×1
dataframe ×1
flower ×1
graphite ×1
matplotlib ×1
npm ×1
plotly ×1
python-3.x ×1
time-series ×1