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.

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?).