Skip to content

numdaplot

About Author License
Package PyPI version Python versions Typed
Testing CI Coverage

Numdaplot is a typed API for arrays, tables and plots, built on numpy, pandas and matplotlib.

  • Documentation: https://ryieru.github.io/numdaplot/
  • Changelog: https://ryieru.github.io/numdaplot/changelog/
  • Source code: https://github.com/Ryieru/numdaplot
  • Bug reports: https://github.com/Ryieru/numdaplot/issues

It provides:

Example

import numdaplot as ndp

prices = ndp.Array.from_list([12.5, 8.0, None, 30.0])
taxed_prices = prices * 1.2
taxed_prices
# Array([15. ,  9.6,  nan, 36. ], dtype=FLOAT64)

high_prices = taxed_prices.select(ndp.Greater(10))
high_prices.to_list()
# [15.0, 36.0]

mean_price = taxed_prices.compute(ndp.Mean())
mean_price.to_value()
# 20.2

sales = ndp.Table.from_csv("sales.csv")
sales.preview()
#      city price
#      TEXT INT64
# 0   Paris   120
# 1    Lyon    80
# 2  Nantes   150
# 3   Lille    95

expensive = ndp.Condition(rule=ndp.Greater(100), columns=["price"])
expensive_sales = sales.filter(ndp.Filter(conditions=[expensive]))
expensive_sales.preview()
#      city price
#      TEXT INT64
# 0   Paris   120
# 1  Nantes   150

chart = ndp.BarChart(x="city", y=["price"])
style = ndp.PlotStyle(title="Price by city", y_label="Price (EUR)")
plot = ndp.Plot.bar(sales, chart, style)
plot.save("prices.png")
# prices.png is the image below

Bar plot of the price by city

Installation

pip install numdaplot

The excel extra reads and writes Excel files, the parquet extra reads and writes Parquet files:

pip install "numdaplot[excel,parquet]"

License

BSD-3-Clause, see LICENSE.