我正在我的应用程序中实现Windows 10通知.但是,下面的代码(运行正常)显然会给出1个TNotification对象和2个字符串的备忘录泄漏,但我在块的末尾释放了对象:
aNotification := NotificationCenter.CreateNotification;
//-- If not assigned then must be Win 8.1 or below
if not assigned(aNotification) then
exit;
try
aNotification.Title := AlignMixVersionName + ' License';
aNotification.AlertBody := aText;
NotificationCenter.PresentNotification(aNotification);
finally
aNotification.Free;
end;
Run Code Online (Sandbox Code Playgroud)
我做了一些愚蠢的事情,或者在通知的实施中是否存在内存泄漏?
我正在创建时间序列计量经济学回归模型.数据存储在Pandas数据帧中.
如何使用Python进行滞后的时间序列计量经济分析?我过去使用过Eviews(这是一个独立的计量经济学程序,即不是Python包).要使用Eviews估算OLS方程式,您可以编写如下内容:
equation eq1.ls log(usales) c log(usales(-1)) log(price(-1)) tv_spend radio_spend
Run Code Online (Sandbox Code Playgroud)
请注意滞后的依赖和滞后价格条款.这些滞后变量似乎很难用Python来处理,例如使用scikit或statmodels(除非我错过了什么).
一旦我创建了一个模型,我就想执行测试并使用模型进行预测.
我对做ARIMA,指数平滑或Holt Winters时间序列预测不感兴趣 - 我主要对时间序列OLS感兴趣.
我有一个耗时的例程,我想使用Delphi XE7的新并行库并行处理.
这是单线程版本:
procedure TTerritoryList.SetUpdating(const Value: boolean);
var
i, n: Integer;
begin
if (fUpdating <> Value) or not Value then
begin
fUpdating := Value;
for i := 0 to Count - 1 do
begin
Territory[i].Updating := Value; // <<<<<< Time consuming routine
if assigned(fOnCreateShapesProgress) then
fOnCreateShapesProgress(Self, 'Reconfiguring ' + Territory[i].Name, i / (Count - 1));
end;
end;
end;
Run Code Online (Sandbox Code Playgroud)
实际上并没有什么复杂的事情发生.如果区域列表变量已更改或设置为false,则例程将循环遍历所有销售区域并重新创建区域边界(这是一项耗时的任务).
所以这是我试图让它平行:
procedure TTerritoryList.SetUpdating(const Value: boolean);
var
i, n: Integer;
begin
if (fUpdating <> Value) or not Value then
begin
fUpdating := …
Run Code Online (Sandbox Code Playgroud) 我想将表面笔功能集成到我的应用程序中.它是用Delphi 10 Seattle编写的.我在网上搜索过,找不到任何东西.
有谁知道如何为笔编程?具体来说,要捕捉压力水平,笔下,笔和笔移动事件.
我正在尝试使用Python进行负二项回归.我发现这个例子使用R和一个数据集:
http://www.karlin.mff.cuni.cz/~pesta/NMFM404/NB.html
我尝试使用以下代码在网页上复制结果:
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.api as sm
df = pd.read_stata("http://www.karlin.mff.cuni.cz/~pesta/prednasky/NMFM404/Data/nb_data.dta")
model = smf.glm(formula = "daysabs ~ math + prog", data=df, family=sm.families.NegativeBinomial()).fit()
model.summary()
Run Code Online (Sandbox Code Playgroud)
不幸的是,这并没有给出相同的系数.它给出了以下内容:
coef std err z P>|z| [95.0% Conf. Int.]
Intercept 3.4875 0.236 14.808 0.000 3.026 3.949
math -0.0067 0.003 -2.600 0.009 -0.012 -0.002
prog -0.6781 0.101 -6.683 0.000 -0.877 -0.479
Run Code Online (Sandbox Code Playgroud)
这些甚至都不在网站上.假设R代码是正确的,我做错了什么?
我正在使用Pandas加载包含邮政编码(例如32771)的Excel电子表格。邮政编码以5位数字的字符串存储在电子表格中。使用命令将它们拉入DataFrame时...
xls = pd.ExcelFile("5-Digit-Zip-Codes.xlsx")
dfz = xls.parse('Zip Codes')
Run Code Online (Sandbox Code Playgroud)
它们被转换成数字。因此,“ 00501”变为501。
所以我的问题是,我该如何:
一种。加载DataFrame并保留存储在Excel文件中的邮政编码的字符串类型?
b。将DataFrame中的数字转换为五位数的字符串,例如“ 501”变成“ 00501”?
我正在将一些csv数据导入Pandas DataFrame(在Python中).一个系列意味着所有数值.但是,它还包含一些虚假的"$ - "元素,表示为字符串.这些都是以前的格式化遗留下来的.如果我只导入该系列,Pandas会将其报告为一系列"对象".
用零替换这些"$ - "字符串的最佳方法是什么?或者更一般地说,如何用数值替换一系列中的所有字符串(主要是数字),并将系列转换为浮点类型?
我正在尝试在画布上绘制字体图标。我正在使用Ionicons字体。我得到的只是屏幕上的一个矩形。
var
x1, y1: integer;
xChr: WideChar;
begin
x1 := 10;
y1 := 10;
fMaleIcon := $f202;
fFemailIcon := $f25d;
if xRep.Male then
xChr := Char(fMaleIcon)
else
xChr := Char(fFemaleIcon);
xCanvas.TextOut(x1, y1, xChr);
end;
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
谢谢 - 史蒂夫
我有一个带有内部受保护类的基本泛型类.如何从基类继承并访问受保护的内部类?
作为示例,此代码将无法编译:
unit uFoo;
interface
type
TFoo<T> = class
protected
type
TFooProtected = class
end;
end;
TFoo2<T> = class(TFoo<T>)
protected
item: TFooProtected;
end;
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Delphi 10 Seattle并尝试创建我的第一个Generic Container类.我需要有关Generic Comparer的帮助
这是我创建的一个简单的Hash对象:
type
TsmHeap<T> = class
private
fList: TList<T>;
Comparer: TComparer<T>;
procedure GetChildren(ParentIndex: integer; var Child1, Child2: integer);
function GetParent(ChildIndex: integer): integer;
function GetCapacity: integer;
function GetCount: integer;
function MustSwap(iParent, iChild: integer): boolean;
procedure SetCapacity(const Value: integer);
public
constructor Create(aComparer: TComparer<T>); overload;
constructor Create(aComparer: TCOmparer<T>; aCapacity: integer); overload;
destructor Destroy; override;
//-- Methods & Functions
function Dequeue: T;
procedure Enqueue(Item: T);
function IsEmpty: boolean;
//-- Properties
property Count: integer read GetCount;
property Capacity: integer read GetCapacity …
Run Code Online (Sandbox Code Playgroud) 我有一个 Dataframe 系列,其中包含每行的字符串列表。我想创建另一个系列,它是该行列表中的最后一个字符串。
所以一行可能有一个列表,例如
['a', 'b', 'c', 'd']
Run Code Online (Sandbox Code Playgroud)
我想创建另一个由该行的最后一个元素组成的 Pandas 系列,通常作为 -1 引用访问,在这个 'd' 中。每个观察(即行)的列表长度不同。如何才能做到这一点?
delphi ×6
python ×5
pandas ×4
dataframe ×1
excel ×1
generics ×1
inheritance ×1
pen ×1
pixelsense ×1
protected ×1
r ×1
regression ×1
statistics ×1
statsmodels ×1
surface ×1
time-series ×1
tthread ×1
unicode ×1
windows-10 ×1
zipcode ×1