Introduction to Pandas Python3 InfosecAddicts
Pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with structured (tabular, multidimensional, potentially heterogeneous) and time series data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical, real world data analysis in Python. Additionally, it has the broader goal of becoming the most powerful and flexible open source data analysis / manipulation tool available in any language. It is already well on its way toward this goal. Reference: https://pypi.org/project/pandas/ 
 Virtualenv installation on linux ubuntu
$ sudo apt-get install python3-venv
Virtual environment creation for python3
$ sudo python3 -m venv env3
After that we activate our virtual environment that we have already created as follows.
$ cd env3
$ cd bin
$ source activate

Now we install the modules that we will use in our virtual environment.

$ pip install numpy
$ pip install panda
We create a .py file to start writing our code.
vim listpandas.py

We copy and paste the following code

import pandas as pd
data= ['hacker', 'ssl', 'injection sql', 'virus', 'worm', 'threat', 'backdoor', 'antivirus', 'infosecaddicts', 'joe']
index=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
serie = pd.Series(data, index=index)
print ("Infosecaddicts data list with pandas\n")
print (serie)
vim list2pandas.py
import pandas as pd
serie = pd.Series(['hacker', 'ssl', 'injection sql', 'virus', 'worm', 'threat', 'backdoor', 'antivirus', 'infosecaddicts'])
print ("Infosecaddicts data list with pandas\n")
print ("NUMBER NAME\n")
print (serie)
In the same way as we work with a list we can work with dictionaries or JSON, this format is widely used in the rest requests and in the communication of backend with frontend.
import pandas as pd
data= {1: 'hacker', 2: 'ssl', 3: 'injection sql', 4: 'virus', 5: 'worm', 6: 'threat', 7: 'backdoor', 8: 'antivirus', 9: 'infosecaddicts', 10: 'joe'}
data = pd.Series(data)
print ("Infosecaddicts data list with pandas\n")
print ("NUMBER NAME\n")
print (data)
Pandas is a very good data manipulation tool. The previous examples are very basic in order to understand the concept, later we will be seeing other examples with a larger volume of data.

Related courses:

Ultimate Hacklab Self Paced

[ihc-select-level]

References:

https://www.learnpython.org/es/Pandas%20Basics

https://pypi.org/project/pandas/

https://docs.docker.com/docker-for-windows/install/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.