reorganization

This commit is contained in:
rasbt 2014-06-01 12:59:24 -04:00
parent 0ce1669ed5
commit dc5210aea9
16 changed files with 1458 additions and 34 deletions

View File

@ -1,9 +1,12 @@
<div align="center">
<h3>A collection of useful scripts, tutorials, and other Python-related things</h3>
<br>
<img src="./Images/logo.png" alt=""> </div>
![logo](./Images/logo.png)
A collection of useful scripts, tutorials, and other Python-related things
<br>
@ -16,7 +19,7 @@ A collection of useful scripts, tutorials, and other Python-related things
###// Python tips and tutorials
- A collection of not so obvious Python stuff you should know! [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/not_so_obvious_python_stuff.ipynb?create=1)]
- A collection of not so obvious Python stuff you should know! [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/tutorials/not_so_obvious_python_stuff.ipynb?create=1)]
- Python's scope resolution for variable names and the LEGB rule [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/tutorials/scope_resolution_legb_rule.ipynb?create=1)]
@ -40,22 +43,27 @@ A collection of useful scripts, tutorials, and other Python-related things
###// Python and the web
- Creating a table of contents with internal links in IPython Notebooks and Markdown documents [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/tutorials/table_of_contents_ipython.ipynb)]
- Creating internal links in IPython Notebooks and Markdown docs [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/tutorials/table_of_contents_ipython.ipynb)]
- 5 simple steps for converting Markdown documents into HTML and adding Python syntax highlighting [[Markdown](./tutorials/markdown_syntax_highlighting/README.md)]
- Converting Markdown to HTML and adding Python syntax highlighting [[Markdown](./tutorials/markdown_syntax_highlighting/README.md)]
<br>
###// Algorithms
- Sequential Selection Algorithms [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/tutorials/sorting_csvs.ipynb)]
<br>
###// benchmarks
###// Benchmarks
*For more recent benchmarks, please also see my separate
GitHub repository [One-Python-benchmark-per-day](https://github.com/rasbt/One-Python-benchmark-per-day)*
- Python benchmarks via `timeit` [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/benchmarks/timeit_tests.ipynb?create=1)]
- Implementing the least squares fit method for linear regression and speeding it up via Cython [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/benchmarks/cython_least_squares.ipynb?create=1)]
- Least squares fit method for linear regression sped up via Cython [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/benchmarks/cython_least_squares.ipynb?create=1)]
- Benchmarks of different palindrome functions [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/benchmarks/palindrome_timeit.ipynb?create=1)]
@ -65,14 +73,14 @@ GitHub repository [One-Python-benchmark-per-day](https://github.com/rasbt/One-Py
###// other
###// Other
- Happy Mother's Day [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/funstuff/happy_mothers_day.ipynb?create=1)]
- Happy Mother's Day [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/other/happy_mothers_day.ipynb?create=1)]
<br>
###// useful scripts and snippets
###// Useful scripts and snippets
- [Shell script](./useful_scripts/prepend_python_shebang.sh) for prepending Python-shebangs to all .py files in a current directory.
- [Shell script](./useful_scripts/prepend_python_shebang.sh) for prepending Python-shebangs to .py files.
- convert 'tab-delimited' to 'comma-separated' CSV files [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/useful_scripts/fix_tab_csv.ipynb?create=1)]

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:b37510e2c48c9811f7baabeff25c48a186e0e5f154b5d341f4eda6701df705e3"
"signature": "sha256:d87105a74c8f25016f90bdec495a890a988277a3f51e0589febbbac87720b033"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -15,7 +15,7 @@
"[Sebastian Raschka](http://sebastianraschka.com) \n",
"last updated: 05/24/2014 ([Changelog](#changelog))\n",
"\n",
"- [Link to this IPython Notebook on GitHub](https://github.com/rasbt/python_reference/blob/master/not_so_obvious_python_stuff.ipynb) \n",
"- [Link to this IPython Notebook on GitHub](https://github.com/rasbt/python_reference/blob/master/tutorials/not_so_obvious_python_stuff.ipynb) \n",
"- [Link to the GitHub repository](https://github.com/rasbt/python_reference) \n",
"\n"
]

View File

@ -6,7 +6,7 @@ _\-- written by Sebastian Raschka_ on March 7, 2014
![sqlite_python_logo.png](../Images/sqlite_python_logo.png)
<img src="../../Images/sqlite_python_logo.png" alt="">
@ -29,7 +29,7 @@ _\-- written by Sebastian Raschka_ on March 7, 2014
• Conclusion
The complete Python code that I am using in this tutorial can be downloaded
from my GitHub repository: <https://github.com/rasbt/python_sqlite_code>
from my GitHub repository: [https://github.com/rasbt/python_reference/tutorials/sqlite3_howto](https://github.com/rasbt/python_reference/tutorials/sqlite3_howto)
* * *
@ -123,8 +123,7 @@ there is more information about PRIMARY KEYs further down in this section).
conn.close()
Download the script: [create_new_db.py](https://raw.github.com/rasbt/python_sq
lite_code/master/code/create_new_db.py)
Download the script: [create_new_db.py](https://raw.github.com/rasbt/python_reference/master/tutorials/code/create_new_db.py)
* * *
@ -135,7 +134,7 @@ lite_code/master/code/create_new_db.py)
![1_sqlite3_init_db.png](../Images/1_sqlite3_init_db.png)
![1_sqlite3_init_db.png](../../Images/1_sqlite3_init_db.png)
Using the code above, we created a new `.sqlite` database file with 2 tables.
Each table consists of currently one column only, which is of type INTEGER.
@ -208,12 +207,11 @@ Let's have a look at some code:
conn.close()
Download the script: [add_new_column.py](https://raw.github.com/rasbt/python_s
qlite_code/master/code/add_new_column.py)
Download the script: [add_new_column.py](https://raw.github.com/rasbt/python_reference/master/tutorials/code/add_new_column.py)
![2_sqlite3_add_col.png](../Images/2_sqlite3_add_col.png)
![2_sqlite3_add_col.png](../../Images/2_sqlite3_add_col.png)
We just added 2 more columns (`my_2nd_column` and `my_3rd_column`) to
@ -275,7 +273,7 @@ But let us first have a look at the example code:
Download the script: [update_or_insert_records.py](https://raw.github.com/rasb
t/python_sqlite_code/master/code/update_or_insert_records.py)
![3_sqlite3_insert_update.png](../Images/3_sqlite3_insert_update.png)
![3_sqlite3_insert_update.png](../../Images/3_sqlite3_insert_update.png)
Both A) `INSERT` and B) `INSERT OR IGNORE` have in common that they append new
rows to the database if a given PRIMARY KEY does not exist in the database
@ -340,7 +338,7 @@ drop the index, which is also shown in the code below.
Download the script: [create_unique_index.py](https://raw.github.com/rasbt/pyt
hon_sqlite_code/master/code/create_unique_index.py)
![4_sqlite3_unique_index.png](../Images/4_sqlite3_unique_index.png)
![4_sqlite3_unique_index.png](../../Images/4_sqlite3_unique_index.png)
@ -407,15 +405,14 @@ Download the script: [selecting_entries.py](https://raw.github.com/rasbt/pytho
n_sqlite_code/master/code/selecting_entries.py)
![4_sqlite3_unique_index.png](../Images/4_sqlite3_unique_index.png)
![4_sqlite3_unique_index.png](../../Images/4_sqlite3_unique_index.png)
if we use the `.fetchall()` method, we return a list of tuples from the
database query, where each tuple represents one row entry. The print output
for the 5 different cases shown in the code above would look like this (note
that we only have a table with 1 row here):
![6_sqlite3_print_selecting_rows.png](../Images/6_sqlite3_print_selecting_rows
.png)
![6_sqlite3_print_selecting_rows.png](../../Images/6_sqlite3_print_selecting_rows.png)
@ -550,7 +547,7 @@ lite_code/master/code/date_time_ops.py)
![5_sqlite3_date_time.png](../Images/5_sqlite3_date_time.png)
![5_sqlite3_date_time.png](../../Images/5_sqlite3_date_time.png)
Some of the really convenient functions that return the current time and date
@ -585,7 +582,7 @@ and entries that are older than 1 day via
Note that we don't have to provide the complete time stamps here, the same
syntax applies to simple dates or simple times only, too.
![5_sqlite3_date_time_2.png](../Images/5_sqlite3_date_time_2.png)
![5_sqlite3_date_time_2.png](../../Images/5_sqlite3_date_time_2.png)
@ -651,7 +648,7 @@ column names):
Download the script: [get_columnnames.py](https://raw.github.com/rasbt/python_
sqlite_code/master/code/get_columnnames.py)
![7_sqlite3_get_colnames_1.png](../Images/7_sqlite3_get_colnames_1.png)
![7_sqlite3_get_colnames_1.png](../../Images/7_sqlite3_get_colnames_1.png)
Since we haven't created a PRIMARY KEY column for `my_table_3`, SQLite
automatically provides an indexed `rowid` column with unique ascending integer
@ -669,7 +666,7 @@ grab the 2nd value in each tuple of the returned list, which can be done by
after the `PRAGMA TABLE_INFO()` call. If we would print the contents of the
variable `names` now, the output would look like this:
![7_sqlite3_get_colnames_2.png](../Images/7_sqlite3_get_colnames_2.png)
![7_sqlite3_get_colnames_2.png](../../Images/7_sqlite3_get_colnames_2.png)
@ -757,9 +754,9 @@ convenient script to print a nice overview of SQLite database tables:
Download the script: [print_db_info.py](https://raw.github.com/rasbt/python_sq
lite_code/master/code/print_db_info.py)
![8_sqlite3_print_db_info_1.png](../Images/8_sqlite3_print_db_info_1.png)
![8_sqlite3_print_db_info_1.png](../../Images/8_sqlite3_print_db_info_1.png)
![8_sqlite3_print_db_info_2.png](../Images/8_sqlite3_print_db_info_2.png)
![8_sqlite3_print_db_info_2.png](../../Images/8_sqlite3_print_db_info_2.png)