Home » Python (page 14)


Python: Streaming/Appending to a file

I’ve been playing around with Twitter’s API (via the tweepy library) and due to the rate limiting it imposes I wanted to stream results to a CSV file rather than waiting until my whole program had finished. I wrote the following program to simulate what I was trying to do:             The program will run ...

Read More »

Python/pandas: Column value in list

I’ve been using Python’s pandas library while exploring some CSV files and although for the most part I’ve found it intuitive to use, I had trouble filtering a data frame based on checking whether a column value was in a list. A subset of one of the CSV files I’ve been working with looks like this:         ...

Read More »

Python Tutorial: Strings Datatype

Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python Numbers. Today we will be covering other standard datatypes i.e. Strings. Note: All examples shown in the post are based on python3. Like other languages, python also has the same meaning/definition for Strings. They are ...

Read More »

Python: Find the highest value in a group

In my continued playing around with a How I met your mother data set I needed to find out the last episode that happened in a season so that I could use it in a chart I wanted to plot. I had this CSV file containing each of the episodes:             I started out by ...

Read More »

The Genius of Python’s Self

When I first started learning python and read about how they do class methods, I was a bit thrown off. To be an object-level method (rather than class-level, like Java static methods), the first parameter needed to be self. Technically, you could name it whatever you wanted, but the first parameter was supposed to be assumed to be an object ...

Read More »

Scripting with Python and AutoHotkey

After I began programming, I started noticing that some of the things I was doing on my computer at home were repetitive and could be automated to save time and effort. Unfortunately my first language was C++, which doesn’t exactly lend itself well to that kind of work. I discovered that certain scripting languages could help me fill that need ...

Read More »