Home » pandas » Page 2

pandas

How to: pandas – drop column

  • by
  • 3 min read

There are many ways to remove a column in a pandas DataFrame. However, some ways are better than others. In this blog post, I elaborate on multiple solutions and what the pros and cons are. First, let’s load the iris dataset from the Seaborn package on GitHub. Drop a pandas… 

Solve DtypeWarning: Columns have mixed types. Specify dtype option on import or set low_memory=False in Pandas

The title of this blog post says it all: let’s solve a warning. It’s one that occurs when you’re using Pandas’ read_csv. Let’s start with just doing that. Let’s say you run into the following error: Solve DtypeWarning: Columns (X,X) have mixed types. Specify dtype option on import or set… 

Pandas: Solve “You are trying to merge on datetime64[ns] and Object columnS”

  • by
  • 2 min read

Without a doubt, Pandas is one of the most popular Python packages within Data Science. However, coming from an R background, discovering the difference between the join and merge method was mind-boggling. Especially if it generates confusing errors that urge you to use pd.concat, which you shouldn’t. This is the… 

Pandas’ pivot_table vs. pivot

  • by
  • 4 min read

When you’re an R poweruser, pivoting tables in pandas feels unnecessarily complex. Why are there two pivot functions? Why does it return an index when you wanted a column? Why does it generate multi index columns? Those are the questions I tackle in this blog post. To answer some questions…