Skip to content

Tag: python

Pickle/unpickle only once per worker

I am using python multiprocessing module to spread say 10000 steps of a given task on 4 workers using a Pool. The task that is sent on the workers is a method of a complex object. If I understand right the documentation, pickle is used to dump and load the object at each step which means 10000 pickling/unpick…

Geopandas not exploding

Why isn’t geopandas exploding this series??? Below I have posted the first 5 rows. Clearly multilinestring and that function isn’t throwing any errors. Any suggestions? Any other idea’s of how to convert multilinestring to linestring would be appreciated. Answer Quick tip for your next quest…

Django 4.x – Conditional order_by of a QuerySet

The Objective The objective is to conditionally order a QuerySet by one of three different date fields in the view based on another field in the model. Since conditional ordering cannot be accomplished with Class Meta I am exploring accomplishing this objective in the view. Here is the relevant excerpt from m…

Converting an argparse bash script into a python script

Consider the bash script below. The script argparse_test.py is an argparse script with various variables. How would I convert this bash script to a python script so that I could run it in a python IDE with the various variables? Answer This bash input should produce a sys.argv that looks like that’s a r…