Data Manipulation
with Pandas Library
Ahmad Ahmadzada
Data Manipulation using Pandas library
Plan:
1) What is Data Manipulation?
2) What is Pandas?
3) Common functions in Pandas
4) Practical example with Pandas
Data manipulation is the process of organizing information to make it readable and understandable. Engineers perform data manipulation using data manipulation language (DML) capable of adding, deleting, or altering data.
While working with disparate data, you need to organize, clean, and transform it to use it in your decision-making process. This is where data manipulation fits in. Data manipulation allows you to manage and integrate data helping drive actionable insights.
Pandas is an open-source library that is made mainly for working with relational or labeled data both easily and intuitively. It provides various data structures and operations for manipulating numerical data and time series. This library is built on top of the NumPy library. Pandas is fast and it has high performance & productivity for users.
Advantages of Pandas:
Pandas generally provide two data structures for manipulating data, They are:
Some common functions in Pandas library
pd.DataFrame(np.random.rand(20,5)) | 5 columns and 20 rows of random floats |
pd.Series(my_list) | Create a series from an iterable my_list |
df.index = pd.date_range('1900/1/30', periods=df.shape[0]) | Add a date index |
df.head(n) | First n rows of the DataFrame |
df.tail(n) | Last n rows of the DataFrame |
df.info() | Index, Datatype and Memory information |
df.columns = ['a','b','c'] | Rename columns |
df.rename(columns={'old_name': 'new_ name'}) | Selective renaming |
df.set_index('column_one') | Change the index |
df.sort_values(col1) | Sort values by col1 in ascending order |
df.sort_values(col2,ascending=False) | Sort values by col2 in descending order.5 |
pd.read_csv(filename) | From a CSV file |
Data Visualization
using Python
Ahmad Ahmadzada
Creating various graphs using visualization libraries
Python Data Visualization Libraries
Matplotlib
Seaborn
Ggplot
Plotly
Geoplotlib
Bokeh
Folium
Altair
Pygal
Gleam
What is Matplotlib?
It provides an interface for creating a wide variety of static, animated, and interactive visualizations in Python.
Matplotlib is designed to be compatible with different types of data, including arrays, lists, and pandas DataFrames, and it supports a wide range of plot types, including line plots, bar plots, scatter plots, histograms, and pie charts, among others.
What is Plotly?
Seaborn
Types of Graph
Line Graphs
Bar Charts
Pie Charts
Histogram
Scatter plot
Area Charts
Radar chart
Box Plots
Using Salary DataSet for Visualization
Bar Chart
Scatter Plot
Pie Chart
scatter plot with plotly
Histogram
Scatter Plot with Seaborn
Hist Plot using Seaborn
Line graph
Thank you for your attention