Silent failure for callback in Excel add-in when using COM
Using Visual Studio 2022 and Excel 365...I've been able to use ExcelDna for plenty of tasks. I run into trouble when I try to use the Excel COM interface directly.To start, I define a button in the...
View ArticleAnswer by chrisaycock for Splitting a string by a character
Boost has the split() you are seeking in algorithm/string.hpp:#include <boost/algorithm/string.hpp>std::string sample = "07/3/2011";std::vector<std::string> strs;boost::split(strs, sample,...
View ArticleAnswer by chrisaycock for Silent failure for callback in Excel add-in when...
Turns out I just needed to use ExcelDna.Interop by adding to my .csproj file:<PackageReference Include="ExcelDna.Interop" Version="*" />
View ArticleShift elements in a numpy array
This question contains its own answer at the bottom. Use preallocated arrays.Following-up from this question years ago, is there a canonical "shift" function in numpy? I don't see anything from the...
View ArticleAnswer by chrisaycock for How to read a Parquet file into Pandas DataFrame?
pandas 0.21 introduces new functions for Parquet:import pandas as pdpd.read_parquet('example_pa.parquet', engine='pyarrow')orimport pandas as pdpd.read_parquet('example_fp.parquet',...
View ArticleUsing Clang's scan-build with scons and C++11
I've added everything to my $PATH and I've tweaked my SConstruct to set the appropriate environment variables, as per these answers [ 1, 2, 3 ]. Now when I run scan-build --use-c++=`which clang++`...
View ArticleHow to decrease size overhead of HDFStore?
I am experimenting with different pandas-friendly storage schemes for tick data. The fastest (in terms of reading and writing) so far has been using an HDFStore with blosc compression and the "fixed"...
View ArticleAnswer by chrisaycock for Seeing all the system calls that were made by a...
Use strace:strace -f java your_programorstrace -f -p <pid of your java program>
View ArticleHow do I revert to a previous package in Anaconda?
If I do conda info pandasI can see all of the packages available.I updated my pandas to the latest this morning, but I need to revert to a prior version now. I triedconda update pandas 0.13.1but that...
View ArticleWhy can't I call load() on a variable?
I can call load() in the REPL.>>> load("trades.csv") symbol timestamp price size AAPL 2019-05-01 09:30:00.578802 210.5200 780 AAPL 2019-05-01 09:30:00.580485 210.8100 390 BAC 2019-05-01...
View ArticleAnswer by chrisaycock for Why can't I call load() on a variable?
Empirical is statically typed. load() will infer a Dataframe's type if the file path can be determined at compile time. Variables and arbitrary expressions are permitted. For example:let filename =...
View ArticleAnswer by chrisaycock for Doubly self-recursive variant to hold JSON?
Generally speaking, you can't define a type that contains itself; this results in an incomplete type. You can, however, define a type that contains a pointer to itself.struct Value { std::variant<...
View ArticleAnswer by chrisaycock for How to calculate Rolling Correlation with pandas?
It's in there, even if hidden a bit:df['Asset1'].rolling(10).corr(df['Asset2'])
View ArticleAnswer by chrisaycock for what is different between char* t=new char and...
Your first case creates a single char element (1 byte) whereas your second case creates 10 consecutive char elements (10 bytes). However, your access of t(x)[100]='m' is undefined in both cases. That...
View ArticleAnswer by chrisaycock for Why can't "asof" join be both "nearest" and "strict"?
This is not permitted because the matched row could be out of order. Imagine this setup:data LeftItem: time: Time, code1: Char enddata RightItem: time: Time, code2: Char endlet left =...
View ArticleWhy can't "asof" join be both "nearest" and "strict"?
Going through the demo, why does Empirical prohibit the following?>>> join trades, events on symbol asof timestamp nearest strictError: join 'asof' cannot be both 'nearest' and 'strict'Is...
View ArticleUnable to subtract datetime64 using DataFrame.eval()
Given a DataFrame with a couple of timestamps:In [88]: df.dtypesOut[88]:Time datetime64[ns]uniqstime datetime64[ns]dtype: objectIf I call eval(), I get a type error:In [91]: df.eval('since = Time -...
View ArticleAnswer by chrisaycock for Does pandas iterrows have performance issues?
Vector operations in Numpy and pandas are much faster than scalar operations in vanilla Python for several reasons:Amortized type lookup: Python is a dynamically typed language, so there is runtime...
View ArticleAnswer by chrisaycock for Create man pages for my own C library
Those comments you see are probably doxygen markup. That can produce man, HTML, and a variety of other formats.
View ArticleAnswer by chrisaycock for How to get the number of CPUs in Linux using C?
#include <unistd.h>long number_of_processors = sysconf(_SC_NPROCESSORS_ONLN);
View Article