Is it possible to perform multi-linear regression in Python using NumPy?
The documentation here suggests that it is, but I cannot find any more details on the topic.
I am using python lxml library to parse html pages:
import lxml.html
# this might run indefinitely
page = lxml.html.parse('http://stackoverflow.com/')
Is there any way to set timeout for parsing?
I have a list in python ('A','B','C','D','E'), how do I get which item is under a particular index number?
Example:
Say it was given 0, it would return A.
Given 2, it would return C.
Given 4, it would return E.
I have 4 reasonably complex r scripts that are used to manipulate csv and xml files. These were created by another department where they work exclusively in r.
My understanding is that while r is very fast when dealing with data, it's not really optimised for file manipulation. Can I expect to get significant speed increases by converting these scripts to python? Or is this something of a waste of time?
hi, i am siva this is frist time taken the python programming language i have a small problem please help me the question is **Write two functions, called countSubStringMatch and countSubStringMatchRecursive that take two arguments, a key string and a target string. These functions iteratively and recursively count the number of instances of the key in the target string. You should complete definitions for
def countSubStringMatch(target,key):
and
def countSubStringMatchRecursive (target, key):
**
I use the following method to break the double loop in Python.
for word1 in buf1:
find = False
for word2 in buf2:
...
if res == res1:
print "BINGO " + word1 + ":" + word2
find = True
if find:
break
Is there better way to break the double loop?
I've a python script that gives me 2 lists and another who is the reference(the time).
How can I create a graphic with the representation of my first list by the time. And same question for the second list. I need them on the same graphic.
list1 [12, 15, 17, 19]
list2 [34, 78, 54, 67]
list3 [10, 20, 30, 40] (time in minutes)
How can I create a graphic in png format with these lists?
Thanks
First of all, I get the name of the current window
win32gui.GetWindowText(win32gui.GetForegroundWindow())
k, no problem with that...
But now, how can I make an if with the result for having an specific string on it...
For example, the result gave me
C:/Python26/
How can I make an True of False for the result containing the word, 'python' ?
I'm trying with re.search, but I'm not being able to make it do it
What are my best options for creating a financial open-high-low-close (OHLC) chart in a high level language like Ruby or Python? While there seem to be a lot of options for graphing, I haven't seen any gems or eggs with this kind of chart.
http://en.wikipedia.org/wiki/Open-high-low-close_chart (but I don't need the moving average or Bollinger bands)
JFreeChart can do this in Java, but I'd like to make my codebase as small and simple as possible.
Thanks!
Hi,
I have a script where I launch with popen a shell command.
The problem is that the script don't wait that popen command is finished and go forward.
om_points = os.popen(command, "w")
.....
How can I tell to my python script to wait until the shell command has finished?
Thanks.
Is there a way to get functionality similar to mkdir -p on the shell... from within python. I am looking for a solution other than a system call. I am sure the code is less than 20 lines... really I am wondering if someone has already written it?
We have some legacy string dates that I need to convert to actual dates that can be used to perform some date logic. Converting to a date object isn't a problem if I knew what the format were! That is, some people wrote 'dd month yy', othes 'mon d, yyyy', etc.
So, I was wondering if anybody knew of a py module that attempts to guess date formats and rewrites them in a uniform way?
Any other suggestions?
Thanks! :)
Eric
Is there any free Python to C translator? for example capable to translate such lib as lib for Fast content-aware image resizing (which already depends on some C libs) to C classes and files?
I have to create an "Expires" value 5 minutes in the future, but I have to supply it in UNIX Timestamp format. I have this so far, but it seems like a hack.
def expires():
'''return a UNIX style timestamp representing 5 minutes from now'''
epoch = datetime.datetime(1970, 1, 1)
seconds_in_a_day = 60 * 60 * 24
five_minutes = datetime.timedelta(seconds=5*60)
five_minutes_from_now = datetime.datetime.now() + five_minutes
since_epoch = five_minutes_from_now - epoch
return since_epoch.days * seconds_in_a_day + since_epoch.seconds
Is there a module or function that does the timestamp conversion for me?
Ignoring all the characteristics of each languages and focusing SOLELY on speed, which language is better performance-wise?
You'd think this would be a rather simple question to answer, but I haven't found a decent one.
I'm aware that some types of operations may be faster with python, and vice-versa, but I cannot find any detailed information on this. Can anyone shed some light on the performance differences?
I was trying to find the right module for downloading kernel patches from
kernel.org site
For example,to download the file at https://patchwork.kernel.org/patch/62948/mbox/
I understand urlgrabber has a problem with https on debian. urllib2 seems to have problem with this url as well (says getaddrinfo failed, even though there are no problems reaching other urls)
Any help would be appreciated
pt=[2]
pt[0]=raw_input()
when i do this , and give an input suppose 1011 , it says list indexing error- " list assignment index out of range" . may i know why? i think i am not able to assign a list properly . how to assign an array of 2 elements in python then?
Is there any benefit in using compile for regular expressions in Python?
h = re.compile('hello')
h.match('hello world')
vs
re.match('hello', 'hello world')
Hi folks,
I'm using the timeout parameter within the urllib2's urlopen.
urllib2.urlopen('http://www.example.org', timeout=1)
How do I tell Python that if the timeout expires a custom error should be raised?
Any ideas?
How can I find as many date patterns as possible from a text file by python? The date pattern is defined as:
dd mmm yyyy
^ ^
| |
+---+--- spaces
where:
dd is a two digit number
mmm is three-character English month name (e.g. Jan, Mar, Dec)
yyyy is four digit year
there are two spaces as separators
Thanks!
I'm looking for up-to-date documentation and tutorials on creating Python bindings for gobjects. Everything I can find on the web is either incomplete or out of date.
got this error in adminpage after I try to save something into model
TypeError at /admin/some/model/1/
int() argument must be a string or a number, not 'RelatedManager'
django 1.2.1
python 2.6.5
os fedora core6
I wanted to know if there was a way I can get my python script located on a shared web hosting provider to read the contents of a folder on my desktop and list out the contents?
Can this be done using tempfiles?