Have you ever wanted to fit a line to a set of data points using Python? Well, if you ever do, here’s how do to it:
Method 1:
The NumPy/SciPy package has a built in function; stats.linregress you can use. I didn’t choose this method because I didn’t want to fool with installing a package for my simple one-off need. There’s an example of using SciPy’s linear regression function here.
Method 2:
I found and modified the linreg function on this helpful website: Simple Recipes in Python by William Park.
Read the rest of this entry »
Posted by Greg Pinero (Primary Searcher) as Python, Excel at 2:56 PM MST
3 Comments »
It turns out that this nifty pyExcelerator program will let you write an Excel formatted document directly from Python.
While you could always use COM automation with the Python Win32 extensions to make Excel documents, I think this library is the way to go. It lets you write an Excel file without even having to have Excel installed, and you don’t even need to be running on Windows. That’s pretty neat. It sounds like an easy way to offer an Excel output format option from your application or website, without requiring any messing with Windows or Excel.
Sadly there wasn’t any friendly documentation for this project online, so here I offer my first code snippet using this package. I mostly figured it out from the example files included with the package. It writes a few rows of data and styles the data depending on content.
Read the rest of this entry »
Posted by Greg Pinero (Primary Searcher) as Python, Excel at 3:47 PM MST
17 Comments »
I didn’t have too much luck locating the answer to this, but one forum suggests that the motherboard is called the Intel Cayman 810E.
Other ways to find out your type of motherboard or other hardware device:
Perhaps get the detailed specs of your machine from its manufactuer.
I also believe that there are programs you can install and run that will print out a detailed report of every hardware device in your computer. The names of those escape me right now.
Tags: Dell Dimension, Dimension, Dell Motherboard
Posted by Greg Pinero (Primary Searcher) as Other at 11:30 PM MST
Comments Off
Here’s the syntax to write to a CSV file:
import csv
w=csv.writer(file(r'C:greg.csv','wb'),dialect='excel')
some_values=[[1,2,3],['A','B','C'],[4,'"5"','ab,c']]
w.writerows(some_values)
Make sure you use ‘wb’ when you open the file. Otherwise I’ve found that it will put a blank line between each row at least when Excel opens it.
Here’s the syntax for reading a csv file (from the documentation):
import csv
reader = csv.reader(open("some.csv", "rb"))
for row in reader:
print row[0], row[-1]
And here’s the link to the full documentation:
http://docs.python.org/lib/module-csv.html
And this takes you straight to the examples in the documentation.
Update:
Another useful writeup of the CSV module.
Tags: Python, csv, csv file, comma delimited, comma seperated values, comma seperated, Python documentation
Posted by Greg Pinero (Primary Searcher) as Python, Excel at 3:20 PM MST
Comments Off
I saw these two charges on my credit statement today and got all worried it was some kind of fraud or other devious thing:

So I called my credit card company, but all they could tell me is that it may be the parent company of a fast food resturant. But using that information I refined my search and finally located the answer:
Lemek LLC is the owner of all Panera Bread restaurants in Maryland. I found the info here.
Read the rest of this entry »
Posted by Greg Pinero (Primary Searcher) as Other at 1:09 PM MST
14 Comments »