diff --git a/andoid_bottle.py b/andoid_bottle.py new file mode 100644 index 0000000..0fc7b19 --- /dev/null +++ b/andoid_bottle.py @@ -0,0 +1,22 @@ +import matplotlib +matplotlib.use('agg') +import pandas as pd +from bottle import Bottle + +app = Bottle() + +@app.route('/index') +def index(): + title = 'Hello World' + plot = 'plot placeholder' + footer = 'created fron an android device using Termux' + html = f'''

{title}

+
+ {plot} +
+ {footer}''' + return html + + +if __name__ == '__main__': + app.run() diff --git a/co2data.py b/co2data.py new file mode 100644 index 0000000..0fb2e73 --- /dev/null +++ b/co2data.py @@ -0,0 +1,2 @@ +import pandas as pd +df = pd.read_csv('https://query.data.world/s/bc2a2nmk6avafkdwy9x5jt7zz') diff --git a/co2plot.html b/co2plot.html new file mode 100644 index 0000000..ddd5fd1 --- /dev/null +++ b/co2plot.html @@ -0,0 +1,702 @@ + + + + + + + + + + + + + + + + + + + + +
+
+
+

Testing out pweave on android with Termux

+
import matplotlib
+matplotlib.use('agg')
+from tabulate import tabulate
+from co2data import df
+
+ +

raw data

+

from data.world

+
# This example will plot the co2 emissions trend for the top 5
+countries in 2011
+
+
+print(tabulate(df.iloc[0:10, 0:5], headers=df.columns,
+tablefmt='simple'))
+
+
  CO2 emission total  1751           1755    1760    1765    1770
+--------------------  -----------  ------  ------  ------  ------
+                   0  Abkhazia        nan     nan     nan     nan
+                   1  Afghanistan     nan     nan     nan     nan
+                   2  Argentina       nan     nan     nan     nan
+                   3  Iceland         nan     nan     nan     nan
+                   4  India           nan     nan     nan     nan
+                   5  Indonesia       nan     nan     nan     nan
+                   6  Iran            nan     nan     nan     nan
+                   7  Iraq            nan     nan     nan     nan
+                   8  Ireland         nan     nan     nan     nan
+                   9  Isle of Man     nan     nan     nan     nan
+
+ +

Transform Data for plotting

+
plot_df = (df
+    .set_index('CO2 emission total')
+    .sort_values('2011', ascending=False)
+    .head(5)
+    .T
+    .dropna(how='all')
+    )
+
+print(tabulate(plot_df.iloc[0:10, 0:5], headers=plot_df.columns,
+tablefmt='simple'))
+
+
        India    Iran    Indonesia    Argentina    Ireland
+----  -------  ------  -----------  -----------  ---------
+1850  nan         nan          nan          nan        396
+1858  436.333     nan          nan          nan        nan
+1859  704         nan          nan          nan        nan
+1860  711.333     nan          nan          nan        nan
+1861  550         nan          nan          nan        nan
+1862  608.667     nan          nan          nan        nan
+1863  674.667     nan          nan          nan        nan
+1864  638         nan          nan          nan        nan
+1865  627         nan          nan          nan        nan
+1866  707.667     nan          nan          nan        nan
+
+ +

Plot the data

+
title = 'Top 5 countries CO2 emissions trend\n(based on 2011 emissions
+data)'
+ax = plot_df.plot(title=title)
+ax.figure.savefig('tmp.png')
+
+ + +
+ + +
+
+
+ + diff --git a/co2plot.py b/co2plot.py new file mode 100644 index 0000000..69c4ca5 --- /dev/null +++ b/co2plot.py @@ -0,0 +1,32 @@ +#' #Testing out pweave on android with Termux + +import matplotlib +matplotlib.use('agg') +from tabulate import tabulate +from co2data import df + +#' ## raw data +#' *from data.world* +# This example will plot the co2 emissions trend for the top 5 countries in 2011 + + +print(tabulate(df.iloc[0:10, 0:5], headers=df.columns, tablefmt='simple')) + +#' ## Transform Data for plotting +#' +plot_df = (df + .set_index('CO2 emission total') + .sort_values('2011', ascending=False) + .head(5) + .T + .dropna(how='all') + ) + +print(tabulate(plot_df.iloc[0:10, 0:5], headers=plot_df.columns, tablefmt='simple')) + +#' Plot the data +title = 'Top 5 countries CO2 emissions trend\n(based on 2011 emissions data)' +ax = plot_df.plot(title=title) +ax.figure.savefig('tmp.png') + + diff --git a/history.txt b/history.txt new file mode 100644 index 0000000..33e542e --- /dev/null +++ b/history.txt @@ -0,0 +1,122 @@ + 1 pip list + 2 python + 3 nano temp.py + 4 packages install nano + 5 packages install nano + 6 nano temp.py + 7 python temp.py + 8 vim + 9 ls + 10 info bash + 11 $dir + 12 $dirname + 13 cd .. + 14 ls + 15 cd home + 16 ls + 17 cd .. + 18 cd usr + 19 ls + 20 cd bin + 21 ls + 22 cd .. + 23 cd + 24 cd.. + 25 ls + 26 git + 27 nano temp.py + 28 vi temp.py + 29 python temp.py + 30 nano temp.py + 31 python temp.py + 32 pip install pandas + 33 python + 34 pip3 install pandas + 35 pip install numpy --use-wheel + 36 apt install conda + 37 apt-get conda + 38 apt-get install conda + 39 apt install Miniconda3 + 40 bash Miniconda3 + 41 bash Anaconda-2.3.0-Linux-x86_64.sh + 42 apt install wget + 43 wget -c http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh + 44 conda install pandas + 45 cknda + 46 minicomda + 47 miniconda + 48 ls + 49* bash Miniconda-latest-Linux-x86_64.sh w + 50 rm Miniconda-latest-Linux-x86_64.sh + 51 ls + 52 wget -c http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86.sh + 53 sudo pip install numpy + 54 apt install sudo + 55 apt install python-numpy + 56 pip install numpy + 57 apt install gcc + 58 apt install brew + 59 apt-get install build-essential + 60 apt get clang -std=c++14 + 61 apt install clang++ -std=c++14 + 62 pip install numpy + 63 clang + 64 apt install clang + 65 pip install numpy + 66 apt install g++ + 67 apt remove clang + 68 pip install numpy + 69 apt install g++ + 70 pip install numpy + 71 pip install python-dev + 72 pip install python-devel + 73 apt install python-dev + 74 pip install numpy + 75 pip install pandas + 76 pip install matplotlib + 77 python + 78 pip install matplotlib + 79 pip install freetype + 80 python + 81 apt-get libfreetype6-dev + 82 apt-get install libfreetype6-dev + 83 apt install libfreetype6e-dev + 84 apt install libfreetype6-dev + 85 apt install freetype + 86 pip install matplotlib + 87* apt install freetype-devw + 88 pip install matplotlib + 89 pip install matplotlib + 90 python + 91 pip install pyobject + 92 pip install pygobject + 93 python + 94 python + 95 ls + 96 test.png + 97 open + 98 xdg-open test.png + 99 pip install bottle + 100 pip install jupyter + 101 jupyter notebook + 102 apt install zmq_strerror + 103 ipython + 104 apt install git + 105 mkdir test + 106 cd test + 107 echo "# test /n testing git from termux" >> readme.md + 108 git init + 109 git add readme.md + 110 git commit -m "first commit" + 111 git config --glob user.email quadmx08@gmail.com + 112 git config --global user.email quadmx08@gmail.com + 113 git config --global user.name "Waylon Walker" + 114 git commit -m "first commit" + 115 remote add origin https://github.com/WaylonWalker/test.git + 116 git remote add origin https://github.com/WaylonWalker/test.git + 117 git push -u origin master + 118 nano readme.md + 119 git commit . "updated readme.md" + 120 git commit . -m "updated readme.md" + 121 git push + 122 history >> history.txt diff --git a/readme.md b/readme.md index 85dfdef..a663d01 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,27 @@ -# test /n testing git from termux +# test + +testing git from Termux for android. This repo was made +entirely fom an android phone using Termux. + +## install + +install a text editor (vim or nano), python-dev, and +freetype-dev. I found python-dev better than python for `pip` +installing packages that required a compiler. freetype-dev was +required for matplotlib. + +``` +apt install nano +apt install python-dev +apt install freetype-dev +``` + + +Now setup your python environment with your favorite packages. +``` +pip install pandas matplotlib bottle +``` +## Example + +CO2 emissions data from data.world [report](http://htmlpreview.github.io/?https://github.com/WaylonWalker/test/blob/gh-pages/co2plot.html) +