Data Analysis with Python - Ipython

Data Analysis with Python - Ipython

1. Some common commands of Ipython

1.TAB auto-completion 2.Variable
+? Display relevant information
3. Function name +? ? You can get the code of the function
4. Use wildcards * np. load ?
5. %run + file name. py can directly execute another script
6. _ and __ will save the two most recent output results
7. _iX and _X x for the line number will output the input and output of line X

2. Keyboard shortcuts

1.CTRL+P forward command
2.CTRL+N backward command
3.CTRL+R Search history by line
4.CTRL+C terminate the program
5.CTRL+A cursor moves to the
beginning of the line End of line
7.CTRL+U clears all text in the current line
8.CTRL+L clears the screen

The magic command

1. %paste will execute the code in the clipboard as a whole.
2.%hist prints the history of all command input
3.%run script.py executes a Python script
4.%time statement reports the execution time of the statement
5.%timeit statement reports the average execution time of the statement

Fourth, execute shell commands

1.!cmd Enter the shell side of the system to execute cmd
2.%pwd returns the current working directory of the system
3.%dirs returns a list containing the current directory stack
4.%env returns the system environment variables in the form of dict
5. Starts with ! The command line indicates that the command needs to be executed in the shell
6.%cd directory Change the system working directory

5. Interactive debugger

1.%debug enter debug
2.q exit debugger
3.b number number line breakpoint

6. Code performance test

1.%time
2.%timeit
3.%prun
4.%run -p

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325044718&siteId=291194637