Saving Ipython script history

%save sessionName linesToKeep

This will save script in line numbers you specify in linesToKeep,for example, 1-20 34-50 64 into a file called “sessionName.py” in your current working directory.

If you are not so specific on which lines you want to keep, you can save everything.

%save sessionName ~0/

This saves everything from the current session, denoted as “~0″ into file “sessionName.py” in your cwd (current working directory).

%save pastSession ~1/

This saves everything from the past session, denoted as “~1” into file “pastSession.py” in your cwd.

Women, men and money

From a dataset on restaurant tip included in the Python seaborn library, we investigate using Python with Jupyter Notebook how much money women and men relatively make, and why.

Most people don’t tip more or less because of server is a man or woman, but we do tip according to tip amount (for equal services).

I will tell you base on data analysis the real reason women make less is mostly because:
1. women work mostly lunch shifts
2. lunch bills are smaller than dinner ones.

Indeed, in every industry, including food services like in the restaurants, women have shouldered more share of the most difficult job in the world: parenting, and dedicated their time and energy to their families.

As a result, they have earned less money than men on average. Let’s give our appreciation to women for their roles in taking care of families!

There is a profound reason why we say “Mother nature”!

Should women work more dinner shifts and leave the important job of taking care of children to …?

That is a difficult question… Take a look at this Jupyter Notebook for the detailed data analysis.
More

Python Data Types | Python 数据类型

Python type NumPy type pandas dtype Usage
str string_, unicode_ object Text
int int_, int8, int16, int32, int64, uint8, uint16, uint32, uint64 int64 Integer numbers
float float_, float16, float32, float64 float64 Floating point numbers
bool bool_ bool True/False values
datetime64[ns] datetime64 Date and time values
timedelta[ns] Differences between two datetimes
category Finite list of text values

Note that what is “str” in Python is called “object” in pandas. This is a potential source of confusion (isn’t everything in Python an object?).

From Zero to One

Why from zero to one? Why not from one to two? The increments are the same. The emphasis is “from zero”, i.e. from none or nothing. I borrowed the term from Peter Thiel’s book title.

The embodiment of the book title is in Chapter 6, where Mr. Thiel tells that the best way to make a 10X improvement is to create something valuable that is completely new.

More than two years ago, I started our website for the purpose of teaching my kids and documenting our teaching. Getting a domain name and setting up the website myself took only hours.  For over a year I had not improved much on the site not only because of lack of time but also I felt I could not make it good enough. But not good enough for whom and for what?    Intuitively I knew it was not possible nor desirable to imitate the all-encompassing and grand Khan Academy.  I also knew it was not going to be a purely math or Chinese teaching website (despite our name).   There is no point in building something that is going to be 1/1000000 of what has been done before.  It has to be something that I truly feel passionate about and do not mind using up my precious “spare” time working on.  And it is not going to take any time away from parenting duties.

Pinwheel of star birth as seen by Hubble (NASA photo)

Pinwheel of star birth as seen by Hubble (NASA photo)

It is going to be a single working mother’s documented daily journey in teaching my young daughters and myself what I believe are important: math, financial math, programming, digital art, Chinese and values.  By doing so, I hope to build a collection of thoughts and records of acts that may help my children, myself and others.

More importantly, it will be developed by the three of us: Elizabeth, Victoria and me. The children will be taking over most of the production work over time as they learn and grow.  If this has never been done before, then it will be truly a from-zero-to-one.