Python Pandas

Python Pandas

What it is …

  • A kind of python packages to deal with data as table format
  • This package is good for data analysis.
  • Most for data scientists

Importing this package

  • command import pandas as pd

DataFrame

  • one of data type in python
  • table format
  • provides various statistical, visualization functions
  • used to read and save data as files — support various file format (e.g. csv, xlsx …)
    1
    2
    3
    pd.read_csv('./[file_name]', encoding = 'utf8')

    pd.to_csv('./[file_name]', encoding = 'utf8', index = False)
    If you are using Mac Book, you do not have to write ‘utf8’ to encode files.

Indexing, Slicing data

  • This is the same as of List type, Numpy.
  • iloc and loc is added in data frame type.
  • You can also find out the data type of vector-data is the series type when the code for columns or rows is written.
  • You can also find the data based on the columns. (or one column)
  • Fancy Indexing can be applied to here!!

To be continued…