Getting Started with Python Pandas

In This Article, You Will Learn about Python Pandas Introduction

Python Pandas Introduction – Before moving ahead, let’s know about Numpy Tutorial

Table of Contents

Installation of Pandas

If you have installed Python and PIP in your system, then you can install Pandas in Python by following this command in Terminal section –

				
					pip install pandas
				
			

If it gets failed, then go with Python distribution that (Anaconda, Spyder, etc.,) already comes with Pre-installed.

Import Pandas

You can import Pandas as once it is installed by using keyword import.

				
					import pandas
				
			

Let’s get started with first Pandas project.

Example – Creating Pandas Object.          

				
					import pandas

first_data = { 'language': ["Python", "C++", "Java"],
  'platforms': ["Windows", "macOS", "Linux"] }

data = pandas.DataFrame(first_data)

print(data)

				
			

Output – 

    language   Platforms
0  Python       Windows
1   C++             macOS
2  Java            Linux

As shown above, it returned a table having “first_data” as its column with index number. 

Pandas as pd

pd is an alternative name to import Pandas.

				
					import as pd
				
			

Now Pandas can be imported as pd

Example – Creating Pandas Object as pd

				
					import pandas as pd

first_data = { 'language': ["Python", "C++", "Java"],
  'platforms': ["Windows", "macOS", "Linux"] }

data = pd.DataFrame(first_data)

print(data)

				
			

Output – 

    language   Platforms
0  Python       Windows
1   C++             macOS
2  Java            Linux

As shown above, it returned a table having “first_data” as its column with index number. 

Checking Pandas Version

Pandas version is stored under __version__ attribute.

				
					import pandas as pd

print(pd.__version__)

				
			

If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.

1 thought on “Getting Started with Python Pandas”

Leave a Comment

Stay in the loop

codingstreets