User Profile

Collapse

Profile Sidebar

Collapse
ronparker
ronparker
Last Activity: Apr 9 '12, 07:22 PM
Joined: Aug 18 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ronparker
    started a topic Too many loops?
    in Java

    Too many loops?

    Hello All!
    I would greatly appriciate some help given I'm just starting out in Java. I have written a pice of code which includes a lot of "for" statments (a few of them are called below). Since they are essentially doing the same thing, (Adding the last X elements of different arrays to a different variable) would it be possible to simplfy this into a process that keeps getting called instead of writting a new for loop everytime...
    See more | Go to post
    Last edited by Niheel; Apr 9 '12, 07:05 PM.

  • ronparker
    replied to circular list?
    in Java
    Any help on this Linked list??




    Code:
    private LinkedList<privStat> MyList = new LinkedList<privStat>();
    public class privStat {
       long Stat1;
       long Stat2;
       float Stat3;
       BigDecimal Stat4;
    }
    
    NewStat = new privStat(//new message)
    if (MyList.size() - 1 < 10) {
       MyList.add(NewStat);
    } else {
        Mylist.remove(0);
    ...
    See more | Go to post

    Leave a comment:


  • ronparker
    started a topic circular list?
    in Java

    circular list?

    Hello!
    I have a private arraylist with classes that include two longs, a float and a BigDecimal. As new data comes in I currently am removing the oldest element, shifiting all other elements over, and then adding the newest element. I think this is taking up a lot of memory uncessearly. So is there anyway to make this a circle, so I don't need to shift over elements in the array? Thank you in advance for any help on this!
    I'll include...
    See more | Go to post

  • How to use python to add a column to a csv file?

    Hello all!
    I have a csv file which is usually has between 100 and 200 columns. I have a new column of data that I want to add to the csv file. I know if you open the file as "A" it will append the file, but I only know how to use it to add new rows to the document. not new columns.
    Right now this code will write three columns of data:
    Code:
    myFile= open( "CC4.csv", "wb" )
    wtr= csv.writer(
    ...
    See more | Go to post

  • Never mind, i think i got it. I just replaced 0 with "" when making the data variable. Thanks again!
    See more | Go to post

    Leave a comment:


  • Thank you so much! However, I still have a question regarding you code. If i now write dataStr to a csv file, all of the cells that are supposed to be blank will have a "0" inside them. Is that easily fixable?
    See more | Go to post

    Leave a comment:


  • How to use python to write to a specific cell in a csv file?

    Hello all!

    I have a list of 5 characters

    Code:
    >>> li
    [1,2,3,4,5]
    I want to write only certain elements of this list to specific cells in a csv file.

    Right now what I am doing is this:
    Code:
    myFile= open( "FILE.csv", "wb" )
    wtr= csv.writer( myFile )
    for li in zip(li):
    	dRow=[li]
    	wtr.writerow(dRow)
    ...
    See more | Go to post
    Last edited by Niheel; Feb 4 '11, 11:07 PM. Reason: merged second question with original question

  • ronparker
    started a topic How to loop to make many .csv files?

    How to loop to make many .csv files?

    Hey guy!
    I have a couple questions, which I don't think are too advanced. I created an algorithm called "Best" for simplicity I will not include the mathematical details of it. I ask the user to input 6 values: Stock, min,win,Stop,GO , and end. Looking at the last 5 inputs, they are all integer inputs eg: 1,2,3.
    This code will take my algorithm and spit out a csv file called "boom.csv" with two columns of numbers...
    See more | Go to post

  • Sorry, I did not include a starting point. Also, I apologize if my values look a little funny. However, I thought something like this to begin. As you can see, I am not very good at this though. So again, help me please!
    Ron Parker

    Code:
    >>> Price = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
    >>> def Best(seq):
    ...     first seq(5)-seq(2)
            second seq(5)-seq(4)
            if first/numpy.abs(first)=second/numpy.abs(second)
    ...
    See more | Go to post

    Leave a comment:


  • ronparker
    started a topic How to create an algorithm to evaluate a string?

    How to create an algorithm to evaluate a string?

    Hello All!
    I am using mysql and python together. I have a table with only two columns: Number and Price. It looks something like this:
    Number, Price
    1, 10
    2, 13
    3, 19
    4, 12
    etc.

    This continues for 90 rows until the Number values restart at 1, however the Price values keep changing. In all there are 900 rows.
    What...
    See more | Go to post

  • ronparker
    replied to How to break down a python list
    I am also curious to know if there is a simple way to see how many positive numbers there are in each 100 segments of the bit 100,000 list. Thank YOU!
    See more | Go to post

    Leave a comment:


  • ronparker
    started a topic How to break down a python list

    How to break down a python list

    Hello all!

    I have a variable name "thelist" which is a list of 100,000 elements. I was wondering how I can make two new lists of the average value and standard deviation from this. For example if my list is [1,2,3,4,5,6,7,8 ,9,10] then the new list would be the average of the every 5 numbers, endeing up looking like [average(1,2,3,4 ,5),average(6,7 ,8,9,10)]=[3,8]. I am very comfortable using numpy to get the average and...
    See more | Go to post

  • ronparker
    started a topic werid python troubles...

    werid python troubles...

    Hello,
    I am just having a little trouble getting python to work correctly. When I try to divide 10 by 3 I get 3 instead of 3.3333 or when I do 1/3 i get 0.
    Code:
    >>> 10/3
    3
    >>> 1/3
    0
    Any ideas as to what is causing this and how i can fix it??
    See more | Go to post

  • ronparker
    started a topic MYSQL where clause help!

    MYSQL where clause help!

    Hello, I am using python to run mysql commands, however I don't think that should be a problem. When I am trying to select vales from a mysql talbe, I am having some trouble with the where clause. The vales DATETIME are all integer values around 38947. When I use the actual value 38947 it selects all 26 rows perfectly. however if I use a variable like thedate=38947, and then use the 'thedate' to select the values form the table, I get an error....
    See more | Go to post

  • ronparker
    replied to Python help making vectors!
    I'm sorry this is taking me so long to get. It seems my problem here is that the datetime.dateti me values are in the square brackets?


    Code:
    import datetime, xlrd
    import MySQLdb as mysql
    start=datetime.datetime(2010, 6, 29, 9, 0, 0)
    end=datetime.datetime(2010, 6, 29, 10, 0, 0)
    results=[]
    while start<=end:
    	results.append(start)
    	start+=datetime.timedelta(minutes=1) 
    	db=mysql.connect(db_info)
    ...
    See more | Go to post

    Leave a comment:


  • ronparker
    replied to Python help making vectors!
    ALMOST THERE!
    I was mistaken for the format of REF_ENTRY_TIME. So timeStr is in the yyyy-mm-dd hh:mm:ss format, but REF_ENTRY_TIME is in the format of datetime.dateti me(y, m, d, h, m, s)
    So is there anyway I can clean this up with these formats?
    Code:
    >>> timeStr
    '2010-06-29 10:00:00'
    >>> 
    >>> c.execute('SELECT REF_ENTRY_TIME FROM actual_data_table WHERE REF_ENTRY_VALUE<700')
    ...
    See more | Go to post

    Leave a comment:


  • ronparker
    replied to Python help making vectors!
    also, timeStr is in the format of yyyy-mm-dd hh:mm:ss which is the same format the entry and exit times are in which is why this is confusing me...
    See more | Go to post

    Leave a comment:


  • ronparker
    replied to Python help making vectors!
    So I have gotten a little further. However I am getting an odd error with the code I provided.
    The error is:
    Code:
    Traceback (most recent call last):
      File "<stdin>", line 6, in <module>
      File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in execute
        self.errorhandler(self, exc, value)
      File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line
    ...
    See more | Go to post

    Leave a comment:


  • ronparker
    replied to Python help making vectors!
    BVDET,
    Thank you for your help on creating the vector for the time dimension. However, do you have any suggestions for the net postion vector? what I mean is with the code i showed earlier, I can get the value at any given time. However, how do i put all of those values into a list or something so i can later graph it against the time with the code you provided?
    I hope I'm being clear.
    Thank you once again!
    See more | Go to post

    Leave a comment:


  • ronparker
    started a topic Python help making vectors!

    Python help making vectors!

    Hello all,

    To begin, I am working with a MySQL database using python. In the database, I am working with 3 columns: REF_ENTRY_TIME, REF_EXIT_TIME, REF_ENTRY_VALUE . My goal is to graph the net value position against time. For the time portion, both REF_ENTRY_TIME and REF_EXIT_TIME are random various times between 9:00 and 12:00. REF_ENTRY_VALUE is just a number around 100. In total I have a bout 50 columns.

    The...
    See more | Go to post
No activity results to display
Show More
Working...