DataFrame考虑一只看起来像下面的熊猫
A B C
0 0.63 1.12 1.73
1 2.20 -2.16 -0.13
2 0.97 -0.68 1.09
3 -0.78 -1.22 0.96
4 -0.06 -0.02 2.18
Run Code Online (Sandbox Code Playgroud)
我想使用该函数.rolling()执行以下计算t = 0,1,2:
t选择从到 的行t+2SS(或有关 的其他汇总统计数据S)例如,t = 1我们有 S = { 2.2 , -2.16, -0.13, 0.97, -0.68, 1.09, -0.78, -1.22, 0.96 } 并且第 75 个百分位数是 0.97。
我找不到让它与 一起工作的方法.rolling(),因为它显然单独使用每一列。我现在依靠 for 循环,但它真的很慢。 …
如何Bitmap从网络(在我的意思是应用程序!)中添加一个可绘制资源?所以我可以访问Bitmap使用R.drawable.bitmapName...
我使用scaffold函数生成了一个简单的Rails 3类:
rails generate scaffold Fattura data:date importo:integer descrizione:text
Run Code Online (Sandbox Code Playgroud)
现在我需要在类中添加另一个字段Fattura.最好的方法是什么?
我已经实现了以下NSOperation,以绘制N自定义视图
- (void)main {
for (int i=0; i<N; i++) {
<< Alloc and configure customView #i >>
//(customView is a UIView with some drawing code in drawrect)
[delegate.view addSubview:customView];
}
NSLog(@"Operation completed");
}
Run Code Online (Sandbox Code Playgroud)
在我的customView的drawRect方法中
- (void)drawRect {
<<Drawing code>>
NSLog(@"Drawed");
delegate.drawedViews++;
if (delegate.drawedViews==VIEWS_NUMBER) {
[delegate allViewsDrawn];
}
}
Run Code Online (Sandbox Code Playgroud)
因此,代表在绘制所有视图时获取通知.
问题是在"操作完成"日志之后,我需要大约5秒才能看到第一个"绘制"日志.
为什么会这样?一般来说,我应该如何表现出哪一行代码占用了这么多时间呢?
------编辑------
有时候(就像10次中的1次一样)我正在崩溃这样做,因为我不应该addsubview从NSOperation 调用,因为它不是线程安全的.所以我改为
[delegate.view performSelectorOnMainThread:@selector(addSubview:) withObject:customView waitUntilDone:NO];
Run Code Online (Sandbox Code Playgroud)
现在我不再崩溃,但这个过程需要很长时间才能执行!比以前多5倍.
为什么这么慢?
我正在使用以下函数将脉冲效果应用于视图
- (void)pulse {
CATransform3D trasform = CATransform3DScale(self.layer.transform, 1.15, 1.15, 1);
trasform = CATransform3DRotate(trasform, angle, 0, 0, 0);
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:trasform];
animation.autoreverses = YES;
animation.duration = 0.3;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.repeatCount = 2;
[self.layer addAnimation:animation forKey:@"pulseAnimation"];
}
Run Code Online (Sandbox Code Playgroud)
我想使用CGAffineTransform self.transform而不是CATransform3D self.layer.transform获得相同的结果.这可能吗?
这个定义有意义吗?
private static final String string = "Constant string";
Run Code Online (Sandbox Code Playgroud)
我是初学者,我不明白最终和静态之间的区别......
我正在研究一个简单的Rails(基于activeRecord)应用程序,我正在本地测试.
现在是时候上线,但是......我需要在应用程序的数据库中再次插入所有记录吗?我希望不是!
你知道是否有可能复制我的整个本地数据库并将其导入heroku?
谢谢!
@events = Event.all(:order => "date DESC")
Run Code Online (Sandbox Code Playgroud)
按日期,datetime列列出我的活动.
是不是可以按日期订购,但只能按小时订购?(我起诉sqlite3数据库)
谢谢!
我正在尝试使用Faye与Rails建立一个简单的聊天室,并将其托管在heroku上.到目前为止,我能够让Faye服务器运行,并获得即时消息.我正在使用的关键代码行是:
页面加载时启动的Javascript文件:
$(function() {
var faye = new Faye.Client(<< My Feye server on Heoku here >>);
faye.subscribe("/messages/new", function(data) {
eval(data);
});
});
Run Code Online (Sandbox Code Playgroud)
create.js.erb,在用户发送消息时触发
<% broadcast "/messages/new" do %>
$("#chat").append("<%= j render(@message) %>");
<% end %>
Run Code Online (Sandbox Code Playgroud)
一切正常,但现在我想在用户断开聊天时通知.我该怎么做?
我已经在Faye的网站上查看了有关监控的信息,但目前尚不清楚我应该在哪里放置该代码.
heroku ×3
android ×1
dataframe ×1
datetime ×1
drawrect ×1
faye ×1
iphone ×1
java ×1
nsoperation ×1
pandas ×1
postgresql ×1
python ×1
scaffolding ×1
sqlite ×1