Compare Same Days of Different Years in Pandas

I'm a newbie still trying to figure out Pandas - split/apply/combine is just starting to make sense but I'm not there yet. I'm trying to get the historical high and low sales call numbers from the same day in previous years (2013-2015), and then hav...
more »

2017-05-16 13:05 (1) Answers

Python, infinite series, plot and Re/Im part

I'm approaching to Python languages, as an alternative to W. Mathematica and I'm here to gain (I hope) some help form who is definitely was more expert than me. I already tried to search for what I need on the web, but the results have been really p...
more »

2017-05-15 15:05 (1) Answers

Vectorize python code for improved performance

I am writing a scientific code in python to calculate the energy of a system. Here is my function : cte1, cte2, cte3, cte4 are constants previously computed; pii is np.pi (calculated beforehand, since it slows the loop otherwise). I calculate the 3 c...
more »

2017-05-14 11:05 (1) Answers

Do something at the beginning & end of methods

Is there an easy way to do something at the beginning and end of each function in a class? I've looked into __getattribute__, but I don't think that I can use it in this situation? Here's a simplified version of what I'm trying to do: class Thing()...
more »

2017-05-13 03:05 (2) Answers

How to replace values in a 4-dimensional array?

Let's say I have a 4D array that is (600, 1, 3, 3) If you take the first 2 elements they may look like this: 0 1 0 1 1 1 0 1 0 2 2 2 3 3 3 1 1 1 etc I have a list that contains certain weights that I want to replace specific values in the arr...
more »

2017-05-11 20:05 (1) Answers

Adjusting methods within a class

I am having issues with properly implementing the following: Remove __hours and __minutes. Adjust the implementation of the mutator and accessor methods. For example, for __init__(hr, min, sec), validate the values, then set __seconds = hr...
more »

2017-05-11 03:05 (1) Answers

How to display Url Image Tkinter python 3

How can I visualize an url of an image with tkinter ("http://images.amazon.com/images/P/0374157065.01.LZZZZZZZ.jpg").I would like to place it in the last column of the program, in standard size, I tried many guides but none of them ever worked. Thank...
more »

2017-05-10 13:05 (1) Answers

Validating data (mutators) in a class

I'm trying to reject data (convert to 0) if for example hour is greater than 23, minute is greater than 60 and second is greater than 60, however I'm having issues where it does not do anything. I'm not sure if I'm just not initializing my get/set me...
more »

2017-05-09 05:05 (3) Answers