Fix Python – anaconda update all possible packages?

I tried the conda search –outdated, there are lots of outdated packages, for example the scipy is 0.17.1 but the latest is 0.18.0. However, when I do the conda update –all. It will not update any packages.
update 1
conda update –all –alt-hint

Fetching package metadata …….
Solving package specifications: ……….

# All requested package….

Fix Python – pandas loc vs. iloc vs. at vs. iat?

Recently began branching out from my safe place (R) into Python and and am a bit confused by the cell localization/selection in Pandas. I’ve read the documentation but I’m struggling to understand the practical implications of the various localization/selection options.
Is there a reason why I should ever use .loc or .iloc over at, and iat or vice….

Fix Python – Ignoring NaNs with str.contains

I want to find rows that contain a string, like so:

However, this fails because some elements are NaN:

ValueError: cannot index with vector containing NA / NaN values

So I resort to the obfuscated

Is there a better way?

Fix Python – Python – json without whitespaces

I just realized that json.dumps() adds spaces in the JSON object
{‘duration’: ’02:55′, ‘name’: ‘flower’, ‘chg’: 0}

how can remove the spaces in order to make the JSON more compact and save bytes to be sent via HTTP?
such as:


Fix Python – Difference between two dates in Python

I have two different dates and I want to know the difference in days between them. The format of the date is YYYY-MM-DD.
I have a function that can ADD or SUBTRACT a given number to a date:
def addonDays(a, x):
ret = time.strftime(“%Y-%m-%d”,time.localtime(time.mktime(time.strptime(a,”%Y-%m-%d”))+x*3600*24+3600))
return ret

where A is….

Fix Python – reducing number of plot ticks

I have too many ticks on my graph and they are running into each other.
How can I reduce the number of ticks?
For example, I have ticks:
1E-6, 1E-5, 1E-4, … 1E6, 1E7

And I only want:
1E-5, 1E-3, … 1E5, 1E7

I’ve tried playing with the LogLocator, but I haven’t been able to figure this out.

Fix Python – What are Flask Blueprints, exactly?

I have read the official Flask documentation on Blueprints and even one or two blog posts on using them.
I’ve even used them in my web app, but I don’t completely understand what they are or how they fit into my app as a whole. How is it similar to an instance of my app but not quite? The documentation is comprehensive but I seek a layman explanat….

Fix Python – python: Change the scripts working directory to the script’s own directory

I run a python shell from crontab every minute:
* * * * * /home/udi/foo/

/home/udi/foo has some necessary subdirectories, like /home/udi/foo/log and /home/udi/foo/config, which /home/udi/foo/ refers to.
The problem is that crontab runs the script from a different working directory, so trying to open ./log/bar.log fails.
Is there a nic….