Pulp problem _dummy

2013-05-23 Thread Ana Dionísio
Hello! I'm using pulp for linear optimization but when I run my code I get the following output: Central Optimization: MAXIMIZE 0*__dummy + 0 SUBJECT TO _C1: 2 T0 >= 0 _C2: 2 T0 <= 0 _C3: 0.0686928673545 Frigorifico0 >= 0 _C4: 0.0686928673545 Frigorifico0 <= 0 _C5: 2 Termo0 >= 0 _C6: 2 Ter

Sum operation in numpy arrays

2013-05-02 Thread Ana Dionísio
Hello! I have several numpy arrays in my script and i want to add them. For example: a=[1,2,3,4,5] b=[1,1,1,1,1] c=[1,0,1,0,1] for i in range(5): d[i]=a[i]+b[i]+c[i] print d [3,3,5,5,7] I did it like that but I get an error: "TypeError: unsupported operand type(s) for +: 'float' and 'num

Scan CSV file and saving it into an array

2013-04-24 Thread Ana Dionísio
Hello! I have this script that scans a csv file and if the value in the first column == 200 it saves that row into an array. The problem is, I need to save that row and the next 10 rows in that same array. What can I add to the script so it does that? I tried to do for row in len(10): but I ge

Re: Reading a CSV file

2013-04-23 Thread Ana Dionísio
The condition I want to meet is in the first column, so is there a way to read only the first column and if the condition is true, print the rest? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a CSV file

2013-04-23 Thread Ana Dionísio
Thank you, but can you explain it a little better? I am just starting in python and I don't think I understood how to apply your awnser -- http://mail.python.org/mailman/listinfo/python-list

Reading a CSV file

2013-04-23 Thread Ana Dionísio
Hello! I need to read a CSV file that has "n" rows and "m" columns and if a certain condition is met, for exameple n==200, it prints all the columns in that row. How can I do this? I tried to save all the data in a multi-dimensional array but I get this error: "ValueError: array is too big."

Lists and arrays

2013-04-22 Thread Ana Dionísio
Hello! I need your help! I have an array and I need pick some data from that array and put it in a list, for example: array= [a,b,c,1,2,3] list=array[0]+ array[3]+ array[4] list: [a,1,2] When I do it like this: list=array[0]+ array[3]+ array[4] I get an error: "TypeError: unsupported operan

Re: CSV to matrix array

2013-04-13 Thread Ana Dionísio
It's still not working. I still have one column with all the data inside, like this: 2999;T3;3;1;1;Off;ON;OFF;ON;ON;ON;ON;Night;; How can I split this data in a way that if I want to print "T3" I would just do "print array[0][1]"? -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV to matrix array

2013-04-12 Thread Ana Dionísio
That only puts the data in one column, I wanted to separate it. For example: data in csv file: 1 2 3 4 5 7 8 9 10 11 a b c d e I wanted an array where I could pick an element in each position. In the case above if I did print array[0][3] it would pick 4 -- http://mail.python.org/mailman/lis

Re: CSV to matrix array

2013-04-12 Thread Ana Dionísio
Hi, thanks for yor answer! ;) Anyone has more suggestions? -- http://mail.python.org/mailman/listinfo/python-list

CSV to matrix array

2013-04-12 Thread Ana Dionísio
Hello! I have a CSV file with 20 rows and 12 columns and I need to store it as a matrix. I already created an array with zeros, but I don't know how to fill it with the data from the csv file. I have this script: import numpy from numpy import array from array import * import csv input = open(

Re: How to do this?

2013-04-01 Thread Ana Dionísio
Nice! Thank you! And if I need something like this? [0 0 0 0 0.17 0.17 0.17 0.17 0 0 0 0.17 0.17 0.17 0 0 0 0 0 0 0] How can I do this? -- http://mail.python.org/mailman/listinfo/python-list

How to do this?

2013-04-01 Thread Ana Dionísio
So I have this script: " from numpy import array vt=[0]*20 vt = array(vt, dtype=dict) for t in range(20): if t == 4: vt[t]=1 else: vt[t]=0 " And have this output: [0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] What I need is when t == 4 I need to put 1 in that position and

Export data from python to a txt file

2013-03-29 Thread Ana Dionísio
Hello!!! I have this lists a=[1,3,5,6,10], b=[a,t,q,r,s] and I need to export it to a txt file and I can't use csv. And I want the next format: a 1 3 5 6 10 b a t q r s I already have this code: "f = open("test.txt", 'w') f.write("a") f.write("\n") f.write("b") f.write("\n") for i in xr

Test a list

2013-03-20 Thread Ana Dionísio
t= [3,5,6,7,10,14,17,21] Basically I want to print Test 1 when i is equal to an element of the list "t" and print Test 2 when i is not equal: while i<=25: if i==t[]: print "Test1" else: print "Test2" What is missing here for this script work? Thank you all -- http:

Lists and Decimal numbers

2013-03-20 Thread Ana Dionísio
So, I have this script that puts in a list every minute in 24 hours hour=[] i=0 t=-(1.0/60.0) while i<24*60: i = i+1 t = t+(1.0/60.0) hour.append([t]) When it is doing the cicle it can have all the decimal numbers, but I need to print the result with only 4 decimal numbers How can I

Re: Excel column 256 limit

2013-03-18 Thread Ana Dionísio
But I still get the error and I use Excel 2010. I'm trying to export data in a list to Excel -- http://mail.python.org/mailman/listinfo/python-list

Excel column 256 limit

2013-03-18 Thread Ana Dionísio
Is there some way to go around this limit? I need to import data from python to excel and I need 1440 columns for that. -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'float' object is not iterable

2013-03-14 Thread Ana Dionísio
But isn't t_amb a list? I thought that the first piece of script would create a list. I'm trying to create a list named t_amb with some values that are in a Excel sheet. And then I need to export that list to another Excel sheet -- http://mail.python.org/mailman/listinfo/python-list

TypeError: 'float' object is not iterable

2013-03-14 Thread Ana Dionísio
Hi!! I keep having this error and I don't know why: TypeError: 'float' object is not iterable. I have this piece of code, that imports to python some data from Excel and saves it in a list: " t_amb = [] for i in range(sh2.nrows): t_amb.append(sh2.cell(i,2).value) print t_amb " Here is e

Re: Recursive function

2013-03-05 Thread Ana Dionísio
Yes, I simplified it a lot. I need to run it 24 times. What I don't really understand is how to put the final temperature (result) in it = 0 in temp_-1 in it =1 -- http://mail.python.org/mailman/listinfo/python-list

Recursive function

2013-03-05 Thread Ana Dionísio
Hello! I have to make a script that calculates temperature, but one of the parameters is the temperature in the iteration before, for example: temp = (temp_-1)+1 it = 0 temp = 3 it = 1 temp = 3+1 it = 2 temp = 4+1 How can I do this in a simple way? Thanks a lot! -- http://mail.python.org/mai

Re: Data Tree urgent help!!!!!!

2013-02-19 Thread Ana Dionísio
Thank you so much!!! It works perfectly!!! ;) -- http://mail.python.org/mailman/listinfo/python-list