Hello,
I'm not a Mac user, but I'm a promoter of Python! I have a good friend using
a Mac who's becoming sceptical of python due to frustrations with the
PYTHONPATH. I'm trying to help...
Everything is fine running vanilla python. Importing modules works fine. But
in ipython, the module paths ne
Sanders,
The problem is I don't want date, I want the date AND hour, just not
minutes.
As for the comparison, in numpy here's what happens when I change the way I
construct the where statements:
--> 196 ind = np.where( (t1 < Y[:,0] < t2) ) #same result
with/without inner parens
197
Alan Gauld wrote:
>
>
> I assume there is a good reason to use a numpy array instead of
> a regular list? ie You need a numpy array elsewhere in the code?
> I've never used numpy bt there is a possibility that array access
> is slower than list access, but I have no idea. It just adds an extra
points in the data.
As for your comment regarding the invariant... would it be:
while hr q:
NOT
while hr not q:
The latter makes more sense to me, but I'm not familiar with this
approach...
Thanks,
john
Bob Gailer wrote:
>
> John [H2O] wrote:
>> Here's a function I wro
Here's a function I wrote to calculate hourly averages:
It seems a bit slow, however... any thoughts on how to improve it?
def calc_hravg(X):
"""Calculates hourly average from input data"""
X_hr = []
minX = X[:,0].min()
hr = dt.datetime(*minX.timetuple()[0:4])
while hr
spir wrote:
>
>
> What you're looking for is a dictionary...
> s = {"cheese":"Brie", "country":"France", ...}
>
> Or maybe a kind of object type that works ~ like a dict, but with object
> syntax (get rid of {} and "" for keys). Example:
>
> class Stuff(object):
> def __iter__(self):
>
Thanks everyone, all of this feedback is valuable!
--
View this message in context:
http://www.nabble.com/creating-a-dict-like-class---asigning-variables...-this-one-may-take-some-thought--%29-tp23759398p24218879.html
Sent from the Python - tutor mailing list archive at Nabble.com.
__
Hello, I am trying to create a class to hold and reference things similar to
matlab's structure.
## A class definition to hold things
class stuff(object):
""" holds stuff """
def __init__():
pass
@classmethod
def items(cls):
stuff = []
for i in cls.__dict__
Hello, I would like to write a script that would have a command line option
of a pid# (known ahead of time). Then I want my script to wait to execute
until the pid is finished. How do I accomplish this?
I tried the following:
#!/usr/bin/env python
import os
import sys
def run_cmd(cmd):
"""RU
I've defined:
def get_contents(infile=file_object):
""" return a list of lines from a file """
contents=infile.read()
contents = contents.strip().split('\n')
return contents
then there's also:
file_object.read()
and
file_object.readlines()
and
file_object.readline()
I think I
10 matches
Mail list logo