10 Pandas Methods That Helped Me Replace Microsoft Excel with Python

10 Pandas Methods That Helped Me Replace Microsoft Excel with Python

How you can use these pandas methods to transition from Microsoft Excel to Python, saving you serious time and sanity.

1. Import an Excel file

This reads your Excel file into a pandas dataframe (the python equivalent of the tabular structure you’re used to). You’ll want to reuse this dataframe, so we’ll save it to the variable df.

df = pd.read_excel(some_file_path)

2. View your new dataframe

It might seem a bit strange at first that you’re not viewing every single row of data like in an Excel file. Here’s how to view the first five records — you can specify this value inside the parentheses, it’s default is just five.

df.head()

3. Count rows

It’s usually helpful to know how many rows you’re working with, so to get this you can call the count method.

df.count()

4. Basic descriptive statistics

With one line of code you’re able to get the min, max and mean of all columns within your dataframe — hopefully you’re starting to be sold using Pandas already…

df.describe()

5. Replace null values

This one is fairly self explanatory, to replace all null values (these appear as NaN -not a number- within a dataframe) with a zero.

df.fillna(0)

You can take this one step further by forward filling, or backwards filling the value with that above or below that particular row.

df.fillna(method='ffill')
df.fillna(method='bfill')

pandas analytics excel python coding

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Python Pandas Objects - Pandas Series and Pandas Dataframe

In this post, we will learn about pandas’ data structures/objects. Pandas provide two type of data structures:- ### Pandas Series Pandas Series is a one dimensional indexed data, which can hold datatypes like integer, string, boolean, float...

Pandas in Python

Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

Why Pandas Hinder You From Perfecting Programming Skills

Python’s popularity is growing the quickest among programming languages. This means more and more employers are looking for developers, data scientists and analysts that know how to program Python and take advantage of its many open source libraries.

Python Tricks Every Developer Should Know

In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.

How to Remove all Duplicate Files on your Drive via Python

Today you're going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates. We gonna use Python OS remove( ) method to remove the duplicates on our drive. Well, that's simple you just call remove ( ) with a parameter of the name of the file you wanna remove done.