我有这样的System.Runtime.InteropServices.COMException : Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Win32.UnsafeNativeMethods.IWebBrowser2.Navigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
at System.Windows.Controls.WebBrowser.DoNavigate(Uri source, Object& targetFrameName, Object& postData, Object& headers, Boolean ignoreEscaping)
at MyApp.Views.BrowserView.Open(Uri uri)
:
df
我想比较A B C D E F
2 a1 a2 a3 a4 100
2 a1 b2 c3 a4 100 # note
2 b1 b2 b3 b4 100
2 c1 c2 c3 c4 100
1 a1 a2 a3 a4 120
2 a1 b2 c3 a4 150 # note
1 b1 b2 b3 b4 130
1 c1 c2 c3 c4 110
0 a1 a2 a3 a4 80
列与B-E
列匹配的F列的结果,如下所示:
A
由于第一行在A B C D E F diff
2 a1 a2 a3 a4 100 120/100
2 a1 b2 c3 a4 100 # note 150/100
2 b1 b2 b3 b4 100 130/100
2 c1 c2 c3 c4 100 110/100
1 a1 a2 a3 a4 120 80/120
1 a1 b2 c3 a4 150 # note
1 b1 b2 b3 b4 130
1 c1 c2 c3 c4 110
0 a1 a2 a3 a4 80
为A
的第一行中具有相同的值,所以我执行1
。
我尝试过的事情:
120/100
-这将数据分组,但是我不知道如何应用计算列df.groupby(['B',' 'C', 'D', 'E'])
的先前值的逻辑。或者也许有一种更简单的方法来实现它。
答案 0 :(得分:1)
将DataFrameGroupBy.shift
与Series.div
一起使用:
public static void SetTickSpacing(Axis axis, int numTicks, int precision)
{
double maxValue = double.MinValue;
double minValue = double.MaxValue;
foreach (Series series in AllSeries)
{
maxValue = Math.Max(GetMaxValue(series, GetAxisOrientation(axis)), maxValue);
minValue = Math.Min(GetMinValue(series, GetAxisOrientation(axis)), minValue);
}
double range = maxValue - minValue;
double spacing = range / numTicks;
spacing = Math.Round(spacing / 10, precision) * 10;
axis.Separator.Step = spacing;
}
public static int GetNumTicksByPixelSpacing(Axis axis, int pixelSpacing)
{
double pixelSize;
if (GetAxisOrientation(axis) == AxisOrientation.X)
{
int index = GetAxisIndexByName(GetAxisCollection(AxisOrientation.X), axis.Name);
pixelSize = cartesianChart.AxisX[index].Width; // this returns NaN
}
else
{
int index = GetAxisIndexByName(GetAxisCollection(AxisOrientation.Y), axis.Name);
pixelSize = cartesianChart.AxisY[index].Height; // this returns NaN
}
return (int)Math.Round(pixelSize / pixelSpacing);
}