Skip to content

Tag: python

Groupby and lag all columns of a dataframe?

I want to lag every column in a dataframe, by group. I have a frame like this: which looks like and I want it to look like this: This question manages the result for a single column, but I have an arbitrary number of columns, and I want to lag all of them. I can use groupby and apply, but

Error Installing Psycopg2 on MacOS 10.9.5

I’m trying to install Psycopg2 on my Macbook, but I am getting an error. I found a lot of the same questions on StackOverflow but no answer seems to work. I’m using: OS: MacOS 10.9.5 Python Version: 3.4.3 My error code is: Answer I ran pip install psycopg2-binary and it worked like charm More info…

How to install pyaudio on mac using Python 3?

I first tried: but I was told that Then I tried: Then I got: but I had installed portaudio Warning: portaudio-19.20140130 already installed So what can I do? Answer I’m assuming you are on a Mac. This is a simple issue to fix. First install Xcode. Then restart your computer. Afterwards run the commands …

Is it possible to run a pypy kernel in the Jupyter notebook?

I have always wondered if it were possible to run PyPy in the Jupyter notebook. I recently tried installing PyPy on my local machine, and it ran really well – 100X speedup in an agent-based simulation written in pure Python. However, I miss the interactivity in the Jupyter notebook. Is it possible to ma…

Drop frame while debugging?

I’d like to know if drop frame is available in PyCharm / Intellij with Python plugin. Here’s what the button looks like (it doesn’t show up on the debug toolbar so I assume it’s just not available for PyCharm) –> How to step one step back in IntelliJ? What I’m trying to …

pygame – How do I change a variable while it is being used?

I’m making a simple top-down game with moving and collision between player and walls, using pygame. I made my code so that when keys[pygame.K_LSHIFT] is True during the pygame.key.get_pressed at the state of the keyboard when it’s called, block_speed changes to 5 instead of 3. So it works and when…