Dropping Duplicates From A Pandas DataFrame

Dropping duplicates from a Pandas DataFrame came into my purview when I noticed a script which contained a ton of networking was sloooooooow. Unfortunately, the endpoint didn’t support asynchronous API calls, so I was stuck getting the job done the ol’ fashioned way. My Setup Python 3.xmacOS The Problem I had tons of data in … Read more

Making a Python Wrapper for your REST API

Need help making a Python Wrapper for your REST API? Python is my personal favorite programming language. So when somebody approaches me with a problem that involves a REST API, I immediately go to Python. That being said, calling REST API’s can unfortunately be a little ugly in the language. I’ll show you how to … Read more

‘python’ is not recognized as an internal or external command, operable program or batch file

So you got the ‘PYTHON’ IS NOT RECOGNIZED AS AN INTERNAL OR EXTERNAL COMMAND, OPERABLE PROGRAM OR BATCH FILE error on your windows machine when trying to set up a new workstation? Maybe you’re new to Python and this is your first error ever? Regardless, it’s cutting into valuable procrastination time so let’s get er’ … Read more

TypeError: String Indices Must be Integers

I’m guessing you’re here because Python threw a, ” TypeError: string indices must be integers”. I got this error after successfully hitting a REST endpoint using the requests Python library and attempting to access one of the responses elements. If you need an example of hitting an endpoint, try this out. It shouldn’t be much different. … Read more

‘Tuple’ Object Has No Attribute ‘Replace’

I got the, ” ‘Tuple’ Object Has No Attribute ‘Replace’ ” error when trying to rename some file paths using python 2.x. This is because the os.walk(dst) returns an array of tuples. Accessing the first element in this tuple can solve the error. I was initially doing the following. dir in this case is the … Read more

For Loop With an Else Clause in Python

Have you ever used a for loop with an else clause in Python? WTH, right? I found out these exist earlier this week when going through some source code. Since it was such a shock I immediately tried to find a use case. Here’s some more detailed documentation. Make sure to search for “4.4” which … Read more

Using the Google Translate API in your Android App

Just make an Http call! So, I thought I’d write a quick article on using the Google Translate API in your Android app since most of the articles I found didn’t help. Article after article pointed me in the direction of this Java library which unfortunately conflicted with other dependencies in my application. I spent … Read more

Length of Values Does Not Match Length of Index

I’m guessing you are dynamically creating Pandas DataFrame columns and came across the, “Length of values does not match length of index” error. The issue lies in that the previous columns you’ve added are not the same length as the most recent one you’ve attempted to add. Let’s recreate the problem. Here’s an article for … Read more

Exit mobile version