Skip to content

Tag: python

Pandas fillna on datetime object

I’m trying to run fillna on a column of type datetime64[ns]. When I run something like: df[‘date’].fillna(datetime(“2000-01-01”)) I get: TypeError: an integer is required Any way around this? Answer This should work in 0.12 and 0.13 (just released). @DSM points out that datetimes…

Specify specific testcases in Python unit test TestLoader

I have the following folder structure. Both the test files have two test cases each. File smoke.py contains The above code runs four test cases which is expected. Is there a way to run some specific test cases from file test1.py and test2.py where I can explicitly add those testcases to the suite1 and suite 2…

What is a ‘NoneType’ object?

I’m getting this error when I run my python script: I’m pretty sure the ‘str’ means string, but I dont know what a ‘NoneType’ object is. My script craps out on the second line, I know the first one works because the commands from that line are in my asa as I would expect. A…

How to use psutil.get_cpu_percent()?

How to exactly use the function get_cpu_percent()? My code is: Here I am calling a Function called SDKTestSuite.DijSDK_CalculateFps() and I am calling get_cpu_percent() to get the CPU usage of this call. I am Calling this function for different inputs, The result is sometimes the CPU usage gives 0.0% which is…

How to find pg_config path

Complete newbie here, trying to set up Django to work with PostgreSQL. I’m using mac osx 10.6.8. I have also installed PostgreSQL 9.3 When I run pip install psycopg2 in terminal I get the following error I’ve seen a number of posts on this how-to-install-psycopg2-with-pip-on-python pg-config-execu…