Re: [Tutor] genfromtxt and dtype to convert data to correct format

2016-05-19 Thread Ek Esawi
Thanks Alan! Taking the strtime off did not work either and printed dattime.dattime(very long date format). I was able to get the integer and string parts fixed via dtype, but could not do the same for date and time. I have a feeling that structured arrays might do the trick but don't know yet how

Re: [Tutor] genfromtxt and dtype to convert data to correct format

2016-05-19 Thread Alan Gauld via Tutor
On 19/05/16 01:31, Ek Esawi wrote: > Thanks Alan! > > Taking the strtime off did not work either and printed dattime.dattime(very > long date format). But isn't that just the representation of a datetime object (which is what strptime produces)? In other words it's an object not a string. Can y

[Tutor] SQLite

2016-05-19 Thread Crusier
Dear Alan, I have read your web page and try to test thing out on SQLite. Attached is my code: import sqlite3 conn = sqlite3.connect('example1.db') c = conn.cursor() c.execute('drop table if exists stocks') c.execute('''CREATE TABLE stocks (code text)''') # Insert a row of data Lis

Re: [Tutor] SQLite

2016-05-19 Thread Peter Otten
Crusier wrote: > Dear Alan, > > I have read your web page and try to test thing out on SQLite. > > Attached is my code: > > import sqlite3 > conn = sqlite3.connect('example1.db') > c = conn.cursor() > c.execute('drop table if exists stocks') > c.execute('''CREATE TABLE stocks > (co

Re: [Tutor] genfromtxt and dtype to convert data to correct format

2016-05-19 Thread Ek Esawi
Thanks again! I tried a combination of the suggestions and still not getting what i want. Here are the original code, file, and output. CODE mport csv; import numpy as np; from datetime import datetime, date, time CF = lambda date: datetime.strptime(bytes.decode(date), '%m/%d/%Y').strftime('%Y

[Tutor] FTP file transfer stops, no error given

2016-05-19 Thread Craig Jackson
The Python script has two objectives: a) create a web page from data in an Excel spreadsheet, b) upload that web page to a web server using ftp. In a nutshell the problem is that if the two objectives are combined into one Python script, ftp stops uploading in the middle of the file, but if the sam

Re: [Tutor] genfromtxt and dtype to convert data to correct format

2016-05-19 Thread Alan Gauld via Tutor
On 19/05/16 12:51, Ek Esawi wrote: > Thanks again! > > I tried a combination of the suggestions and still not getting what i want. > > Here are the original code, file, and output. > > CODE > > mport csv; import numpy as np; from datetime import datetime, date, time > > CF = lambda date: datet

Re: [Tutor] SQLite

2016-05-19 Thread Alan Gauld via Tutor
On 19/05/16 10:03, Crusier wrote: > c.execute('''CREATE TABLE stocks > (code text)''') > > # Insert a row of data > List = ['1', '2', '3', '4', '5', '6', '7', > '8', '9', '00010', '00011', '00012'] > > c.executemany('INSERT INTO stocks VALUES (?)'

Re: [Tutor] FTP file transfer stops, no error given

2016-05-19 Thread Alan Gauld via Tutor
On 19/05/16 15:11, Craig Jackson wrote: > ftp. In a nutshell the problem is that if the two objectives are > combined into one Python script, ftp stops uploading in the middle of > the file, but if the same code is split into two files, web page > creation in one script and ftp in another, and the

[Tutor] Create a pivot table

2016-05-19 Thread jarod_v6--- via Tutor
Dear All! This is my data from a file. I want to obtain a count table how many times c11 are present for each project and Samples and Program. ['Program', 'Sample', 'Featurename', 'Project'], ['A', 'A100', 'c11', 'post50'], ['A', 'A100', 'c12', 'post50'], ['A', 'A100', 'c14', 'post50'], ['A

Re: [Tutor] Create a pivot table

2016-05-19 Thread Peter Otten
jarod_v6--- via Tutor wrote: > Dear All! > This is my data from a file. I want to obtain a count table how many > times c11 are present for each project and Samples and Program. > > ['Program', 'Sample', 'Featurename', 'Project'], > ['A', 'A100', 'c11', 'post50'], > ['A', 'A100', 'c12', 'post

Re: [Tutor] FTP file transfer stops, no error given

2016-05-19 Thread Craig Jackson
Adding the parentheses worked. So sorry for taking your time. I'm new to Python and not at all a programmer. Thanks for your help. On Thu, May 19, 2016 at 11:37 AM, Alan Gauld via Tutor wrote: > On 19/05/16 15:11, Craig Jackson wrote: > >> ftp. In a nutshell the problem is that if the two objecti

[Tutor] Getting started in testing

2016-05-19 Thread Terry Carroll
Is anyone aware of any good tutorials on testing one's Python code? These days, I'm a hobby programmer, writing little things just for my own use, and don't really sweat testing much. But I do have one niche open-source project where I need to be a bit more regimented, and specifically need to

Re: [Tutor] FTP file transfer stops, no error given

2016-05-19 Thread Alan Gauld via Tutor
On 19/05/16 19:01, Craig Jackson wrote: > Adding the parentheses worked. So sorry for taking your time. I'm new > to Python and not at all a programmer. Thanks for your help. No trouble, that's what the list is here for. Just remember next time to post the code that fails rather than the code tha

Re: [Tutor] Getting started in testing

2016-05-19 Thread Alan Gauld via Tutor
On 19/05/16 20:34, Terry Carroll wrote: > Is anyone aware of any good tutorials on testing one's Python code? I'm not a big fan of video tutorials but I recently had to teach myself Junit testing (and mockito) in Java and I found that Youtube videos really helped. I know there are similar videos o

Re: [Tutor] Tutor Digest, Vol 147, Issue 30

2016-05-19 Thread Crusier
Dear Peter & Alan, Thanks alot. Have a great day Cheers, Hank On Fri, May 20, 2016 at 12:00 AM, wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/tutor > or

Re: [Tutor] Getting started in testing

2016-05-19 Thread Danny Yoo
On Thu, May 19, 2016 at 12:34 PM, Terry Carroll wrote: > Is anyone aware of any good tutorials on testing one's Python code? > > These days, I'm a hobby programmer, writing little things just for my own > use, and don't really sweat testing much. But I do have one niche > open-source project where