I developed a spreadsheet app in Python. I'm using NumPy and pandas.
The following data is used for explanation.
Country Area Population
Russia 17,098,242 145,934,462
Canada 9,984,670 37,742,154
United States 9,833,517 331,002,651
China 9,596,960 1,439,323,776
Brazil 8,515,770 212,559,417
Australia 7,741,220 25,499,884
Data source Countries in the world by population (2020)
If you put a column name between [
and ]
, that column will be extracted. You can extract multiple columns separated by commas. For example, t [Country, Area]
extracts the Country and Area columns.
If you use [: 3]
, the 0th to 3rd lines will be extracted. You can get the same result by doing [0: 3]
.
Type [2:]
to extract all lines from the third line. That is, the lines up to the second line are deleted.
If you enter t [2]
, only the United States on the third line will be extracted as shown in the figure below.
If you add a hyphen -
to the column name, it will be sorted by that column. One hyphen is in ascending order.
As shown in the figure below, two hyphens are in descending order. China is at the top.
Put a column name and expression after &
to add a new column.
In the figure above, a column called population density is added. The formula is Density = Population / Area
.
An example of adding a population density column, removing the area column, sorting by population density, and extracting the top three countries.
command
t &Density=Population/Area [Country,Population,Density] --Density [:3]
You can optionally enter functions such as mean and variance. a is the average. Just type t a
to get the average for each column.
Option list
a average median median mode mode var distribution std standard deviation
In the above example, we added columns with the formula Density = Population / Area
, but advanced functions can also be entered intuitively.
Nested functions are also supported. Most standard functions such as trigonometric functions are included. Exponentiation uses **
instead of ^
.
I've used t
so far, but you can use g
to display the figure. Since the graph is under development, only the primitive Matplotlib graph is displayed. Also, you cannot connect to the t
command.
For graphs, enter options such as line
in the g
command. Currently, only two columns of data can be displayed in a bar graph and a line graph.
Spreadsheet app Spreadsheet
Official page Math-Serif
All documentation is written in English, but spreadsheet apps all work with the t
command. Of course, the input data and output data are not saved in the server.
Recommended Posts