Pandas - Python library.

 Pandas

  • Pandas is open source python library
  • Used for data analysis.
  • Also helpful in data mungling.
  • Data Mungling - 
    • Combination of data cleaning, data manipulation, and data understanding we call it as data munging.

How to install pandas.

Type pip install pandas in your cmd. If you are using anaconda (it is a python distribution) in this the pandas is already installed.

To check the pandas version

  • We import pandas as import pandas as pd.
  • Type - pd.__version__

Basic pandas function you should know.

  1. pd.read_csv - To read csv file.
  2. pd.head() - to print top 5 line.
  3. pd.tail() - to print last 5 line.
  4. pd.describe() - to describe the dataset.
  5. pd.info() - to check the complete info about the dataset.
  6. pd.shape - It's a attribute, help to know shape of dataset
  7. pd.shape[0] - print  number of rows.
  8. pd.shape[1] - print number of columns.
  9. pd.columns - It will print all the columns name.
  10. pd.column_name - The column_name that you want will be selected.
  11. pd['column_name'] - Same as 10.

Series

  1. 1 - D datatype in pandas.
  2. Elements are indexed.
  3. Can be created from the list.
  4. Negative indexing is not possible.
  5. Since, You can access the data with the help of square bracket notation [].

Syntax

 pd.Series(data, index=index)
index is an optional.

Example
Creating Series and printing it's values and index.





Comments