Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Data Analysis

You're reading from   Python Data Analysis Perform data collection, data processing, wrangling, visualization, and model building using Python

Arrow left icon
Product type Paperback
Published in Feb 2021
Publisher Packt
ISBN-13 9781789955248
Length 478 pages
Edition 3rd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Ivan Idris Ivan Idris
Author Profile Icon Ivan Idris
Ivan Idris
Avinash Navlani Avinash Navlani
Author Profile Icon Avinash Navlani
Avinash Navlani
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Section 1: Foundation for Data Analysis
2. Getting Started with Python Libraries FREE CHAPTER 3. NumPy and pandas 4. Statistics 5. Linear Algebra 6. Section 2: Exploratory Data Analysis and Data Cleaning
7. Data Visualization 8. Retrieving, Processing, and Storing Data 9. Cleaning Messy Data 10. Signal Processing and Time Series 11. Section 3: Deep Dive into Machine Learning
12. Supervised Learning - Regression Analysis 13. Supervised Learning - Classification Techniques 14. Unsupervised Learning - PCA and Clustering 15. Section 4: NLP, Image Analytics, and Parallel Computing
16. Analyzing Textual Data 17. Analyzing Image Data 18. Parallel Computing Using Dask 19. Other Books You May Enjoy

Using IPython as a shell

IPython is an interactive shell that is equivalent to an interactive computing environment such as Matlab or Mathematica. This interactive shell was created for the purpose of quick experimentation. It is a very useful tool for data professionals that are performing small experiments.

IPython shell offers the following features:

  • Easy access to system commands.
  • Easy editing of inline commands.
  • Tab completion, which helps you find commands and speed up your task.
  • Command History, which helps you view previously used commands.
  • Easily execute external Python scripts.
  • Easy debugging with the Python debugger.

Now, let's execute some commands on IPython. To start IPython, use the following command on the command line:

$ ipython3

When you run the preceding command, the following window will appear:

Now, let's understand and execute some commands that the IPython shell provides:

  • History Commands: The history command used to check the list of previously used commands. The following screenshot shows how to use the history command in IPython:
  • System Commands: We can also run system commands from IPython using the exclamation sign (!). Here, the input command after the exclamation sign is considered a system command. For example, !date will display the current date of the system, while !pwd will show the current working directory:
  • Writing Function: We can write functions as we would write them in any IDE, such as Jupyter Notebook, Python IDLE, PyCharm, or Spyder. Let's look at an example of a function:
  • Quit Ipython Shell: You can exit or quit the IPython shell using quit() or exit() or CTRL + D:

You can also quit the IPython shell using the quit() command:

In this subsection, we have looked at a few basic commands we can use on the IPython shell. Now, let's discuss how we can use the help command in the IPython shell.

Reading manual pages

In the IPython shell, we can open a list of available commands using the help command. It is not compulsory to write the full name of the function. You can just type in a few initial characters and then press the tab button, and it will find the word you are looking for. For example, let's use the arrange() function. There are two ways we can find help about functions:

  • Use the help function: Let's type help and write a few initial characters of the function. After that, press the tab key, select a function using the arrow keys, and press the Enter key:
  • Use a question mark: We can also use a question mark after the name of the function. The following screenshot shows an example of this:

In this subsection, we looked at the help and question mark support that's provided for module functions. We can also get help from library documentation. Let's discuss how to get documentation for data analysis in Python libraries.

Where to find help and references to Python data analysis libraries

The following table lists the documentation websites for the Python data analysis libraries we have discussed in this chapter:

Packages/Software

Description

NumPy

https://numpy.org/doc/

SciPy

https://docs.scipy.org/doc/

Pandas

https://pandas.pydata.org/docs/

Matplotlib

https://matplotlib.org/3.2.1/contents.html

Seaborn

https://seaborn.pydata.org/

Scikit-learn

https://scikit-learn.org/stable/

Anaconda

https://www.anaconda.com/distribution/

You can also find answers to various Python programming questions related to NumPy, SciPy, Pandas, Matplotlib, Seaborn, and Scikit-learn on the StackOverflow platform. You can also raise issues related to the aforementioned libraries on GitHub.

You have been reading a chapter from
Python Data Analysis - Third Edition
Published in: Feb 2021
Publisher: Packt
ISBN-13: 9781789955248
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime