Skip to content

A C++ TimeSeries library that aims to mimic pandas Series

License

Notifications You must be signed in to change notification settings

polarsorg/polars

Repository files navigation

polars

A c++ library that defines a TimeSeries class that behaves a bit like pandas.Series

swimming polar

Getting started

Clone the repo as usual with git clone

then:

git submodule update --init --recursive

This will fetch the dependencies (google test, date.h and armadillo at present).

The library should be easy to integrate with add_submodule but this is yet to be tested.

If you get a dirty tree in dependencies/armadillo-code/examples/Makefile you may want to:

cd dependencies/armadillo-code
git update-index --assume-unchanged examples/Makefile

The file that changed is actually built by cmake so the changes can be readily ignored.

To install - WIP (need to add the install() command to the CMakeLists.txt)

Building with Conan

Building with Conan requires:

Armadillo and polars can both be found in the polars org remote. Build with:

conan remote add polars-org https://polars.jfrog.io/artifactory/api/conan/polars-conan
cd conan
conan create . -s compiler.cppstd=14 --build missing

To build for android:

conan create .  -s:h compiler.cppstd=14 --build missing --profile:build ./conan/profiles/linux-profile --profile:host ./conan/profiles/android-armv8-profile

What is polars?

Polars was built to make cross platform mobile deployment easy - prototype in python, port quickly into C++, wrap into a library and deploy into ios and android.

Being strongly and staticly typed it catches many bugs at compile time.

In general:

  • CMake installation (WIP)
  • Developed and tested on macos primarily but should support linux distros
  • Benefits from Accellerate on osx and ios through underlying library
  • Good unit test coverage
  • Alpha release - expect breaking changes in the near future, but will settle down quickly as we are following pandas.

Provides the following methods for a Series:

  • Construction from armadillo vectors or std::lib vectors - xtensor to follow soon.
  • .to_map() (like .iter_rows())
  • arithmetic operators +, -, *, / with another Series or with a numeric type
  • comparison operators ==, !=, >=, <=, >, < with another Series or with a numeric type
  • .diff()
  • .where()
  • .loc()
  • .iloc()
  • .abs()
  • .pow()
  • .count()
  • .mean()
  • .sum()
  • .std()
  • .quantile()
  • .dropna()
  • .fillna()
  • .diff()
  • .clip()
  • .apply()
  • .empty()
  • .head()
  • .tail()
  • .to_timeseries_map()
  • << operator overloading (pretty printing)
  • .rolling() supporting mean, quantile, std, sum for flat windows and triangle windows.
  • .ewm() rolling mean for exponential windows.
  • arctan2() element-wise arc tangent of x1/x2 choosing the quadrant correctly
  • concat() concatenation of two series

It also provides a SeriesMask class which is the result of any comparison operation and is used as the input to .where().

The SeriesMask provides the following methods:

  • comparison operators &, |, ! with another Series
  • .to_series() to convert to bool type to double
  • << operator overloading (pretty printing)

To make working with time series easier, we also have an experimental TimeSeries class derived from Series. This is a Series under the hood, but can be constructed and indexed with std::chrono types to remove the burden of working with times.

What is coming up?

  • All unit tested (with moving CI to open source project) - Circle has granted us free containers just need to switch on
  • testing in docker against ubuntu environment
  • Example python bindings project
  • Further development and tests for TimeSeriesMask
  • LocalTimeSeries that works with std::chrono::local_clock where TimeSeries works with std::chrono::system_clock (i.e. utc)
  • Making .rolling() more pandas with .rolling().mean() syntax
  • date literals for TimeSeries
  • [] syntax for subsetting Series
  • EnumSeries to support strongly typed categorical series

About

A C++ TimeSeries library that aims to mimic pandas Series

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •