Hello, I searched the web and python.org but I haven't found a good resource
that explains how to upgrade python from 2.4 to 2.5
What I'm wondering is whether I'll have to start from scratch on the
installation of all my external modules such as Numpy, Matplotlib, PyXML,
etc...
Could someone pl
I know there must be a better way to do this with slices, but I can't seem to
figure it out - I keep getting errors about the need to have the same
dimensions:
Here's what I'm trying:
>>> type(time)
>>> type(new_data)
>>> shape(time)
(1334,)
>>> shape(new_data)
(1334, 54)
>>> newArray=concatena
Thank you again.
I can see your point about not wanting the tempDATA var hanging around, so I
guess this is better as a function. And yes, the transpose is for the 'next
step' - sorry if that cause anyone confusion.
Danny Yoo-3 wrote:
>
>
> If you already have the values as a list of rows, w
Thanks,
I'm not really trying to create a function. I actually thought this would be
as simple as the 'load' command to get the data in from a file. But I just
couldn't find the documentation online to do it once i have the data already
'inside' of python as a list. So, my options are:
1) write
Hello, I have a list of strings:
data =
[ '33386.472.22-1.11 0.43'
'33386.67 3.33 -1.23 0.54'
...
'46728.470.1-1.87-0.54'
'46728.479.75.680.38'
'46729.47-0.17-0.470.23']
I wish to convert it to a numpy array of floats. How do I accomplish t
Could someone please explain 'slices' also for dictionaries?
basically, I'd like to know how you would call every 3rd element in a list
of lists...
My logic says: ThirdElems=List[:][2]
Which to me reads, for every item in List (which are lists), return the
third item.
but this doesn't work.
T
Answering my own question here, but for the sake of it... adding:
os.chdir(newpath)
makes it all work... so we have:
def run_cmd(cmd):
"""RUN A BASH CMD"""
import subprocess as sub
p = sub.Popen(['/bin/bash', '-c', cmd],
stdout=sub.PIPE, stderr=sub.STDOUT)
output =
Hello,
I'm converting a perl script which calls shell scripts which call fortran
routines into a python cgi that calls fortran directly (well, not yet using
f2py), but using subprocess.popen. Here's my code:
def run_cmd(cmd):
"""RUN A BASH CMD"""
import subprocess as sub
p = sub.Popen(
Yes, I'm using 2.4, and will not likely be able to upgrade... so, the final,
as you suggested Kent:
dates_dt=([datetime.datetime(int(dates_list[i][0][:4]),int(dates_list[i][0][4:6]),
int(dates_list[i][0][6:8]),int(dates_list[i][0][8:10]),
It's not pretty, but this is what seems to work... I'd be happy hear more
about a better approach... I like the idea of using a list, but ran into
troubles with min and max, maybe I don't entirely understand the lambda
function, but when I tried a list, I got an error that min() has no optional
va
Hello,
I'm using the code below to select the closest dates in a dictionary of
dates, to selected dates (Tstart, Tend)... Now, I need to get all the dates
(slice) from the dictionary in between the two dates TstartNew and TendNew.
Basically, I need to know what the 'index' is for them in the in t
Thanks everyone these seem like promising directions to go... Eric, any
chance you could share your 'similar' code? The problem it seems with
paramiko is that it has little 'newbie' documentation, and I'm not clear how
to set up the reverse port forwarding on it. Thus I may need to use the
pexpect
Hello, I'm trying to write a script which will allow me to create a reverse
tunnel from a remote machine using SSH -R
I know the reverse tunnel script works on it's own run from the shell, but I
don't want to leave it open always... does anyone have any ideas on how to
make this work? There seems
I have a Dictionary, that is made up of keys which are email
addresses, and values which are a list of firstname, lastnamet,
address, etc...
If I run the following:
#! /bin/python
import csv
last = {}
rdr = csv.DictReader(file("reg-data.csv"))
for row in rdr:
#print row
last[row
WAY too large a project I'm afraid. Yes, that would be the one which
would make me an 'expert' in Python ;)
Too bad there's just no time right now...
On 5/10/07, Bob Gailer <[EMAIL PROTECTED]> wrote:
> John Washakie wrote:
> > I have access to the source code
>
> I want to create a fully functional program that actually does something
> USEFUL.
And just what would that be? Ask yourself that.. then perhaps folks on
the list could guide you in the right direction...
-j
___
Tutor maillist - Tutor@python.org
h
I have access to the source code. And I probably could pass the data
to stdout, so maybe .popen would work! I'll have a look... thanks!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I have a FORTRAN program which reads in unformatted sparse matrix
data. Rather than rewriting the code in Python, I was hoping there is
a way to call the Fortran program, passing filename variables TO
Fortran, and returning the data (which is an array) back to my .py
code for use there.
Is there a
And of course, thanks all!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
It aint pretty! And if I had just walked away, it probably would've
taken half the time in the morning, but here's what I've come up with
(any suggestions for improvements, or course are welcome):
for d in data:
w = len(d)
if d[0] <= tinit+60:
d = column_stack(d)
Ug,
It still doesn't make sense due to the sum/cnt where cnt is just an
int, and sum is a 1-dimensional array!
I'm missing something here about working with numpy arrays...
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/
Thanks for the feedback,
The average was a little bit goofed up. Here's what I have now:
for d in data:
if d[0] <= tinit+60:
d = column_stack(d)
cnt=cnt+1
sum = sum+d
else:
avg = sum/cnt
if init==0:
newData = av
Oops, I meant it crashes at line 7..
>
> 1) tinit = data[0][0]
> 2)for d in data:
> 3)if d[0] <= tinit+60:
> 4)sum = sum+d
> 5)else:
> 6)avg = sum/len(sum)
> 7)newData = append([newData],[avg],axis=0)
> 8)tinit = d[0]
>
>
Hello, I'm trying to calculate an average for columns in my
array(data), there's a catch though, I want to create a new array of
shorter length (NOTE: this crashes at line 8):
1) tinit = data[0][0]
2)for d in data:
3)if d[0] <= tinit+60:
4)sum = sum+d
5)else:
6)
Jessica,
Assuming you have python installed on your system (Windows?, *nix?),
then all you have to do is double click the .py file and it will run.
If you want, you can run it from the command line:
C:\> python yourfile.py
On 5/1/07, Jessica Brink <[EMAIL PROTECTED]> wrote:
>
>
> I know thi
Thanks
>
> Depending on what an 'empty' element is you may have to refine that.
>
I also noted, if I used:
tmp = data[6].strip().split()
rather than:
tmp = data[6].strip().split(' ')
I eliminated the 'empty' elements...
___
Tutor maillist - Tuto
I can't recall how to do this:
I want:
a = [int(x) for x in tmp]
but, my tmp has some empty elements, so it fails...
Therefore I want to be able to say:
a = [int(x) for x in tmp IF x in tmp]
I know there's a way! Ive seen it before, but now cannot find it! 'if'
is a pretty generic thing to se
Hello all,
I'm trying to write a program which will take a path, look in it for
all files matching a certain pattern, then create javascript player to
play them. A key part of the code at this point is:
searchPath = imageRoot + '*' + imgExt
avail = glob.glob(searchPath) #will glob work over http
Hello all,
I'm writing a program which take input about a path. The path may be
http or absolute or local. Once I have the path, I want to search the
directory for images (type also defined by user), then get a count on
the number of images in order to build the rest of my program:
searchPath = i
Excellent. Thanks Luke, that seems to be working
On 4/25/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
> John Washakie wrote:
> > Tested. Failed...
> >
> > I thought it would be something like that, but that doesn't work..
> > perhaps because '
TECTED]> wrote:
> On 4/25/07, John Washakie <[EMAIL PROTECTED]> wrote:
>
> > cat raw.html |
> > sed 's/ImagePathReplaceMe/NewPathToImage/g' |
> > sed 's/TitleReplaceMe/NewTitle/g' > new.html
>
> One line's sufficient:
>
Folks,
I'm writing a program which will read in an html file, and then
replace certain elements, such as the title, and various paths defined
for images. I can make a 'source' file with ImagePathReplaceMe and
TitleReplaceMe text in it, then search for that and replace it. With
sed my script would
Thanks so much! Now another task, associated with this one... what I
actually ultimately want is to just pull out several fields from the text
file in the zip archive (there is actually only one file).. so, my goal is
the to create a file that looks like:
t[0], x[0], y[0]
t[1], x[1], y[1]
t[2], x
Thank you both! That seems to make my code much more clear... I thought
it was foolish writing files, but I just couldn't determine how to
parse the data!
Kent, one thing, regarding:
x = []
t = []
for l in data[stind:-1]:
l = l.split() # Split on whitespace
34 matches
Mail list logo