IndexError: only integers, slices (`:`), ellipsis (`…`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

python

Soooo you got the IndexError: only integers, slices (`:`), ellipsis (`…`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices error. Let’s get that annoying message fixed. My Computer Setup Python3 macOS For those Short On Time You’re trying to access an element of a Pandas index like df.columns where df is a DataFrame …

Read more

Create a Class in Python3

python

So how do you create a class in Python3? What is class? Why do we need a class? All great questions. My Computer Setup Python3 (Finally getting used to adding parentheses around my print statements ) macOS What is an object? So let’s go over what a class is. Classes are the preliminary step to …

Read more

Filter a Pandas DataFrame in Python

python

We’ll be showing you how filter a Pandas DataFrame in Python. So let’s set the scene. You work for a massive food company that sells deli meats and fruits. You’ve been toiling at your computer for hours trying to create a dataframe of your company’s product info. Department XYZ needs that data so they can …

Read more

Clone a Git Repo in Python3

python

So you want to clone a git repo in Python3? I recently came across a case where I wanted to programmatically edit and update a Github repo and what better language to use than Python? My first go at the problem had me thinking of .bat files since I come from a Windows background. Therefore …

Read more

Making A Twitter Bot With Tweepy

python

Want help making a Twitter bot with Tweepy? It’s actually pretty easy after you apply for a developer’s account and setup an app on Twitter’s side. You can do the application and setup here. My Computer Setup Getting your Environment Setup You can find some info on installing pip here. The article actually covers pip installation …

Read more

Search For Strings Across Files in Linux

bash

Need to search for strings across files in Linux or on a Linux server? Use GREP! This will help you find that pesky module that needs updating or that misspelled table name. My Computer Setup macOS The Solution This command will recursively search files and folders for whatever you’re interested in. Still learning about how …

Read more

Change Directory on a Mac, Linux, or Windows Machine

bash

We’ll be showing you how to change directory on a Mac, Windows, or Linux machine. Need to do something to a file on the terminal? Need to delete an entire folder and its children on the command line like I show here? Well first you might want to get to the same directory where it’s …

Read more

Delete a Folder and Its Children on a Mac or Linux Terminal

bash

This is how you delete a folder and its children on a mac or linux terminal. Be careful because the f means force! For those of Short on Time Explanation of the Command rm means remove on the command line. rm stuff.py would remove the stuff.py file. This doesn’t work when it’s presented folders. We …

Read more

Programmatically Renaming File Paths with Python

python

Programmatically renaming file paths with Python has made my life easier in more ways than we have time for in this article. Am I being dramatic? Most definitely. That being said, it is a ridiculously time saving hack to learn. For example did your company’s name recently change and now you’re faced with updating a …

Read more

Modulos in Python

python

Modulos in Python are super useful. They can we be used when we don’t want to print a check each pass during a loop. For example, if I’m looping through 100,000 numbers and want to get an update of how my automation is going every so often instead of printing each loop or blindly running …

Read more