Chapter 1 : Data Handling using Pandas
- Introduction to Pandas
- Data Structure in Pandas
- Introduction to Series
- Creation of Series
- Series Attributes
- Mathematical operations on Series
- Head and Tail Function
- Slicing in Series
- Selection in Series
Introduction and creation of Series
From previous notes, it is now clear that series is an one dimensional labelled array, which is size mutable and value mutable. Let’s now look at different methods for creating a Series in Python. Make sure to import pandas library in a program before creating a series object.
Creating an empty series
For creating an empty series which have no data values, we will use Series( ) function as follows:
Seriesobject=pandas.Series()
As per above statement , no argument is to be given within Series( ) function. Given below is a code in which an empty Series S1 is created.
Creating Series from a dictionary?
A dictionary is an unordered data type in which elements are present in key:value pair. As Series can also be created using a dictionary , in which all keys of the dictionary becomes the labels/index of series object and values of dictionary becomes data in a Series. In the example given above a series S is created using a dictionary d which contains 4 key and value pairs. When we print Series
Pandas for Data Analysis?
- It is very helpful in extracting meaningful set of information from big and bulky data sets.
- In pandas, data can be easily organised in a tabular structure containing rows and columns. This makes the analysis of data more simplified.
- It supports various data formats, like numbers, strings, decimals etc.
- Based on present set of data it also helps in predicting the future trends. So, it is therefore having TIME-SERIES functionality.