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

Python Lambda Functions For Idiots

python

What are Python Lambda Functions? They weren’t something I could easily infer from casually seeing it in code or context clues. I had to do a little digging. What I took from my reading, is that they are more concisely written functions. My Setup Example They make this: Into this: I personally think they’re beautiful … Read more

Drop Duplicates From An Array In Python

python

So, you need to drop duplicates from an array in Python. Maybe you’re iterating through this array and calling an api and need to cut down on the super expensive networking? Regardless, it’s fairly straight forward. My Setup Python 3.xmacOS The Solution We use set() to drop duplicates from an array in Python. A set … Read more

Dropping Duplicates From A Pandas DataFrame

python

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

python

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

python

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

python

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’

python

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