Thanks for the solution above,
The raw data looked like
User-ID,COUNTS
576460840144207854,6
576460821700280307,2
576460783848259584,1
576460809027715074,3
576460825909089607,1
576460817407934470,1
and i used
CSV_INPUT1 = "C:/Example work/Attr_model/Activity_test.csv"
fin1 = open(CSV_INPUT1, "rb"
Hi All
i have a CSV file that i'm reading in and each line has the look of
the below
{None: ['User-ID', 'Count']}
{None: ['576460847178667334', '1']}
{None: ['576460847178632334', '8']}
i want to make a dictionary of items in the form
{576460847178667334:1, 576460847178632334:8, . } for all r
Thanks Raymond,
That's a neat trick, i'll look into learning more about this
Mike
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Diez,
This is almost perfect!
Is there a way to ensure each list has two elements, even if one of
them is blank?
Mike
--
http://mail.python.org/mailman/listinfo/python-list
Hi All,
I have two dictionaries e.g
dict1 = {123:3,234:5,456:3}
dict2 = {123:4,157:2,234:5,456:3,567:2}
I want to merge these two dictionaries together so i have a resultant
dictionary of:
dict3 = {123:[4,3],157:[2,0],234:[5,5],456:[3,3],567:[2,0]}
As later on i want to write a csv file that wo
Hi All,
I'm trying to use the CSV module to read in some data and then use a
hashable method (as there are millions of records) to find unique ids
and push these out to another file,
can anyone advise? Below is the code so far
fin = open(CSV_INPUT, "rb")
fout = open(CSV_OUTPUT, "wb")
reader = c
That is a nice piece of code,
I cracked the idea of the shift; problem, my final problem is still
how to convert
my @row = $sth->fetchrow_array;
$$StartDate = $row[0];
$$EndDate = $row[1];
$sth->finish()
into python code as i'm not sure what $$ means
Any help on this final part woul
Thanks for that Daniel,
I've been able to apply the logic to the rest of the script i'm
converting.
There are only two bits that i don't understand in the Perl script
that i need to convert,
my $sql = shift;
and
my @row = $sth->fetchrow_array;
$$StartDate = $row[0];
$$EndDate = $row[1]
Hi All,
I've been given a Perl script that i'm trying to convert into python.
The aim of the script links to MqSQL database, but i'm stuck on one
part
my $sth = $dbh->prepare($sql)||
die "Could not prepare SQL statement ... maybe invalid?:$!\n$sql
\n";
$sth->execute()||
die "C
Superb, thanks
--
http://mail.python.org/mailman/listinfo/python-list
Hi experts,
I've just seen there is an R module, what i can't see easily is if you
can / how to import other modules for R into the Rpy module
Can anyone advise on this?
Cheers
Mike
--
http://mail.python.org/mailman/listinfo/python-list
Hi All,
Can anyone point me towards some code for Maximum Likilehood for
distribution in python?
Thanks
Mike
--
http://mail.python.org/mailman/listinfo/python-list
Hi Experts,
I've written a peice of code that works fine and fits, and passes
values into a peice of SPSS code, the problem is that it is not
dynamic, and so i though about how i can make it dynamic, (other code
may not have upto 10 some may have more) and came up with regex for an
idea, but i can
I was just trying to do it with the CSV module
--
http://mail.python.org/mailman/listinfo/python-list
Hi Chris that's exactley what i wanted to do,
Many thanks
--
http://mail.python.org/mailman/listinfo/python-list
just saw i needed to change record.startswith to row.startswith
but i get hte following traceback error
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework
\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "Y:\te
I did just try to post, but it doesn't look like it has appeared?
I've used your advice Andrew and tried to use the CSV module, but now
it doesn't seem to pick up the startswith command?
Is this because of the way the CSV module is reading the data in?
I've looked into the module description but i
Cheers for the help, the second way looked to be the best in the end,
and thanks for the boolean idea
Mike
working_CSV = "//filer/common/technical/Research/E2C/Template_CSV/
DFAExposureToConversionQueryTool.csv"
save_file = open("//filer/common/technical/Research/E2C/Template_CSV/
CSV_Data2.c
Hi Larry,
i'm still getting to grips with python, but rest assured i thinkn it's
better for me to write hte code for learnign purposes
My basic file is here, it comes up with a syntax error on the
startswith line, is this because it is potentially a list?
My idea was to get the lines number where
Hi All,
I want to read in a CSV file, but then write out a new CSV file from a
given line..
I'm using the CSV reader and have the the line where i want to start
writing the new file from begins with
"Transaction ID",
i thought it should be something along the lines of below.. obvioulsy
this does
Hi,
I currently have an excel table (1 table each time) that has differing
number of rows and differing number of columns each time, for another
program i use (SPSS) to import the data i need to know the cell range
of this data table.
I.e what the last row of data is and the last column that has d
No Problem,
Thanks for your help so far, i've sent this problem off to SPSS as it
seems it doesn't work on a work colleagues machine either
Thanks for your time though
Mike
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the quick reply,
the code i am running is the following
import win32com.client
xl = win32com.client.Dispatch("Excel.Application")
ppt = win32com.client.Dispatch("PowerPoint.Application")
ppt.Visible = 1 #open MS Powerpoint
xl.Visible = 1 #open MS Excel
xl.Workbooks.Open('%s/working_out
I've got a slight problem when running an excel macro from python using
the win32.com.client module, in that it says it can't load the DLL file
(it doesn't say which one)
and gives me the following error message
Traceback (most recent call last):
File "", line 93, in ?
File ">", line 14, in R
Fredrik Lundh wrote:
> Mike P wrote:
>
> > Does anyone know where i can download acopy of the SAX2 module?
>
> the built-in xml.sax module implements the SAX 2 protocol, if that's
> what you're looking for:
>
> http://docs.python.org/lib/module-xml.sax
Does anyone know where i can download acopy of the SAX2 module?
Cheers
Mike
--
http://mail.python.org/mailman/listinfo/python-list
After just running trying that update it hits the macro perfectly but
hten i get an error message after i type in a couple of values.. as per
below
Traceback (most recent call last):
File "", line 148, in ?
File ">", line 14, in Run
File "C:\Python24\Lib\site-packages\win32com\client\dynamic
Thanks for your advice on this matter,
I'm actually using Excel 2003!! so it shows how much i know!
i did manage to get the prog to run with the line
xl.Application.Run("CTP.xla!sheet1.CTP")
but it didn't do anything... i'm guessing it is along the lines of wht
you were saying earlier about big
On Fri, 9 Sep 2005 13:55:03 -0700, Trent Mick wrote:
> [Mike Meyer wrote]
>> stri ker <[EMAIL PROTECTED]> writes:
>>> Has anyone here upgraded from 2.3 to 2.4 on Tiger?
>>> If so how'd ya do it?
>>
>> You don't. You install 2.4 in parallel with 2.3. You can do pretty
>> much whatever you want wit
sn't support
the boolean and set types which are part of Python 2.4 and are used in
pygraphlib.
I get errors of the form:
AttributeError: Marshaller instance has no attribute 'tag_bool'
AttributeError: Marshaller instance has no attribute 'm_Set'
Again strange given that bool
"Björn Lindström" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "F. Petitjean" <[EMAIL PROTECTED]> writes:
>
> > res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ]
> >
> > Hoping that zip will not be deprecated.
>
> Nobody has suggested that. The ones that are planned to be removed are
"Magnus Lycka" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> James wrote:
> > The brain may be fine for generating Python from UML but it is MANY
> > MANY orders of magnitude harder to generate UML from code with just
> > your brain than using a tool (usually zero effort and error
"RM" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Of course, the licensing terms may still be too restrictive for those
> that want to create comercial closed source applications and can't
> afford the comercial license of Qt. That is why, for many, wxPython
> will remain the pre
age just in case,
but I still
get the SAPI not supported error.
Anyone get this working - any suggestions? Or am I missing something
obvious?
Thanks In Advance.
Mike P.
--
http://mail.python.org/mailman/listinfo/python-list
34 matches
Mail list logo