Skip to content

wrighters.io

Thoughts on python, data science, and related tools.

  • About
  • Privacy Policy

Tag: pandas

Selecting in Pandas using where and mask

January 21, 2021January 21, 2021 ~ Matt Wright ~ Leave a comment

This is the fifth post in a series on indexing and selecting in pandas. If you are jumping in the middle and want to get caught up, here's what has been discussed so far: Basic indexing, selecting by label and locationSlicing in pandasSelecting by boolean indexingSelecting by callable Once the basics were covered in the … Continue reading Selecting in Pandas using where and mask

Indexing and Selecting in Pandas by Callable

January 11, 2021January 11, 2021 ~ Matt Wright ~ 2 Comments

In pandas, you can use callables where indexers are accepted. It turns out that can be handy for a pretty common use case.

Indexing and Selecting in Pandas – slicing

December 29, 2020January 14, 2021 ~ Matt Wright ~ Leave a comment

Slicing data in pandas This is second in the series on indexing and selecting data in pandas. If you haven't read it yet, see the first post that covers the basics of selecting based on index or relative numerical indexing. In this post, I'm going to review slicing, which is a core Python topic, but has … Continue reading Indexing and Selecting in Pandas – slicing

Indexing and Selecting in Pandas (part 1)

December 26, 2020December 31, 2020 ~ Matt Wright ~ 4 Comments

The topic of indexing and selecting data in pandas is core to using pandas, but it can be quite confusing. One reason for that is because over the years pandas has grown organically based on user requests so there are multiple way to select data out of a pandas DataFrame or Series. Reading through the documentation can be … Continue reading Indexing and Selecting in Pandas (part 1)

Overview of I/O tools in Pandas

December 7, 2020 ~ Matt Wright ~ Leave a comment

Pandas has a lot of functionality, but before you can explore or use it, you'll most likely want to access some data from an external source. You'll also likely want to store results for use later or be able to export results to other tools or to share with others. Pandas has a lot of … Continue reading Overview of I/O tools in Pandas

Removing duplicate data in Pandas

November 30, 2020 ~ Matt Wright ~ Leave a comment

It can be very common when dealing with time series data to end up with duplicate data. This can happen for a variety of reasons, and I've encountered it more than one time when and tried different approaches to eliminate the duplicate values. There's a gem of a solution on Stack Overflow and I thought … Continue reading Removing duplicate data in Pandas

Converting types in Pandas

November 22, 2020 ~ Matt Wright ~ Leave a comment

Pandas is great for dealing with both numerical and text data. In most projects you'll need to clean up and verify your data before analysing or using it for anything useful. Data might be delivered in databases, csv or other formats of data file, web scraping results, or even manually entered. Once you have loaded … Continue reading Converting types in Pandas

Basic Pandas: Moving a DataFrame column

September 19, 2020November 25, 2020 ~ Matt Wright ~ Leave a comment

Sometimes we want to change the ordering of a DataFrame's columns. Maybe you are saving your data and require the columns to be in a certain order, or you may have a large number of columns and want a few of them to be visible whenever viewing your DataFrame in an interactive session, so you … Continue reading Basic Pandas: Moving a DataFrame column

Basic Pandas: Renaming a DataFrame column

September 17, 2020November 25, 2020 ~ Matt Wright ~ Leave a comment

A very common need in working with pandas DataFrames is to rename a column. Maybe the columns were supplied by a data source like a CSV file and they need cleanup. Or maybe you just changed your mind during an interactive session. Let's look at how you can do this, because there's more than one … Continue reading Basic Pandas: Renaming a DataFrame column

Basic Pandas: How to add a column to a DataFrame

September 10, 2020November 25, 2020 ~ Matt Wright ~ Leave a comment

Pandas is one of my favorite Python libraries, and I use it every day. A very common action is to add a column to a DataFrame. This is a pretty basic task. I'm going to look at a few examples to better show what is happening when we add a column, and how we need … Continue reading Basic Pandas: How to add a column to a DataFrame

Posts navigation

Older posts

Pages

  • About
  • Privacy Policy

Categories

  • Finance
  • Python
  • Software

Recent Posts

  • Selection in pandas using query
  • Selecting in Pandas using where and mask
  • Indexing and Selecting in Pandas by Callable
  • Boolean Indexing in Pandas
  • Indexing and Selecting in Pandas – slicing

Archives

  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
Proudly powered by WordPress ~ Theme: Penscratch 2 by WordPress.com.