
I have already mentioned Pandas Library in my previous post(How to download and install Pandas) on this blog. Pandas library provides easy to use data structure and data analysis tool for Python programming language. Pandas also enables you to carry out your entire data analysis workflow in Python without switching to a more domain specific language like R. Pandas combined with the Ipython’s toolkit and some other libraries, creates an environment for doing data analysis in Python which excels in performance, productivity, and the ability to collaborate.
In this blog post, I am showing “How to import Pandas library” and ” What are the basic operations that you can perform using Pandas”.
- How to import Pandas Library in your code ?
You can import Pandas library by typing the following: import pandas as pd
Here you can see that I have imported Pandas library as pd, so that wherever I need to use Pandas library I can use the pd keyword. - How to create a data frame using Pandas library ?
The code in the above screenshot creates a basic data frame. That looks like the following in the console:
Here the index of the data frame is default(i.e. 0,1,2 and 3) , you can change the index by adding the index attribute to the data frame(for e.g To use the date as the index, you can set index=dates, where the date is already defined by us in the code). Here is what the new output looks like:
There are many other things that you can do using Pandas library which can make your analysis a lot easier. You can see the full documentation at http://pandas.pydata.org/pandas-docs/stable/index.html
