? get negative from prod(x) when x is positive integers

2013-06-28 Thread Vincent Davis
'max = ', 4, 'min = ', 1) . ('prod =', 0, 'max =', 4, 'min =', 1) ('prod =', 1729382256910270464, 'max =', 4, 'min =', 1) ('prod =', 0, 'max =', 4, 'min =', 1) Whats going on? Vincent Davis 720-301-3003 -- http://mail.python.org/mailman/listinfo/python-list

Re: ? get negative from prod(x) when x is positive integers

2013-06-28 Thread Vincent Davis
ms to be a result of using ipython, or at least how I am using it "ipython notebook --pylab inline". Thanks Vincent Davis 720-301-3003 On Fri, Jun 28, 2013 at 4:04 PM, Joshua Landau wrote: > On 28 June 2013 15:38, Vincent Davis wrote: > > I have a list of a list of intege

Understanding and dealing with an exception

2012-10-13 Thread Vincent Davis
I am working on a script to find bad image files. I am using PIL and specifically image.verify() I have a set of known to be bad image files to test. I also what to be able to test any file for example a .txt and deal with the exception. Currently my code is basically try: im = Image.open(ifil

Re: Understanding and dealing with an exception

2012-10-13 Thread Vincent Davis
Oops, I was going to make note of the file size. 1.2MB Vincent On Sat, Oct 13, 2012 at 10:31 PM, Chris Angelico wrote: > On Sun, Oct 14, 2012 at 3:23 PM, Vincent Davis > wrote: > > OverflowError: Python int too large to convert to C long > > line 266, in _maketile >

Re: Understanding and dealing with an exception

2012-10-13 Thread Vincent Davis
On Sun, Oct 14, 2012 at 3:36 PM, Vincent Davis > wrote: > > Oops, I was going to make note of the file size. 1.2MB > > Then I'd definitely declare the file bad; I don't know what the valid > ranges for channels and ysize are, but my reading of that is that your >

Re: Understanding and dealing with an exception

2012-10-14 Thread Vincent Davis
Yes afile is the file name and extension, ifile is the full file name and path. Thanks Vincent On Sunday, October 14, 2012, MRAB wrote: > On 2012-10-14 05:23, Vincent Davis wrote: > >> I am working on a script to find bad image files. I am using PIL >> and specifically image

get each pair from a string.

2012-10-21 Thread Vincent Davis
I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe there is not :-) In the end I am going to what to get triples, quads... also. Thanks Vincent -

Re: get each pair from a string.

2012-10-21 Thread Vincent Davis
ings if I get a chance later today. Thanks again! Vincent On Mon, Oct 22, 2012 at 12:45 AM, Emile van Sebille wrote: > On 10/21/2012 11:33 AM, Vincent Davis wrote: > >> I am looking for a good way to get every pair from a string. For example, >> input: >> x = 'app

Re: get each pair from a string.

2012-10-21 Thread Vincent Davis
@vbr Thats interesting. I would never have come up with that. Vincent On Sun, Oct 21, 2012 at 3:48 PM, Vlastimil Brom wrote: > vbr -- http://mail.python.org/mailman/listinfo/python-list

Re: get each pair from a string.

2012-10-21 Thread Vincent Davis
ote: > >> On Sun, Oct 21, 2012 at 12:58 PM, Vincent Davis >> wrote: >> >>> x = 'apple' >>> for f in range(len(x)-1): >>> print(x[f:f+2]) >>> >>> @Ian, >>> Thanks for that I was just looking in to that. I wonder

Check email header for RFC 822 standard and match emails between imap servers.

2011-08-18 Thread Vincent Davis
ageWrapper::GetMessageReceivedTime @ 170 ( gmetan...@domain.com )> Failed with 0x80004001, last successful line = 168. 2011-08-16T16:47:47.328-06:00 808 E:Migration ExchangeMigration!GetMessageDescription @ 198 (gmetan...@domain.com)> Sent: 2011-08-16T22:47:47.000Z. Received: 2011-08-16T

Standard config file format

2011-04-05 Thread Vincent Davis
I am working on a program to monitor directory file changes and am would like a configuration file. This file would specify email addresses, file and directory locations.. Is there a preferred format to use with python? -- Thanks Vincent Davis -- http://mail.python.org/mailman/listinfo

set a breakpoint in malloc_error_break to debug?

2011-04-06 Thread Vincent Davis
in malloc_error_break to debug Traceback (most recent call last): File "", line 1, in MemoryError: >>> Python 2.7.1 |EPD 7.0-2 (32-bit)| (r271:86832, Dec 3 2010, 15:41:32) [GCC 4.0.1 (Apple Inc. build 5488)] -- Thanks Vincent Davis 720-301-3003 -- http://mail.python.org/mailman/listinfo/python-list

plot / graph connecting re ordered lists

2018-01-23 Thread Vincent Davis
example code for this on the net an am not finding a clean example. Thanks Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: plot / graph connecting re ordered lists

2018-01-23 Thread Vincent Davis
On Tue, Jan 23, 2018 at 4:15 PM Dennis Lee Bieber wrote: > On Tue, 23 Jan 2018 13:51:55 -0700, Vincent Davis > declaimed the following: > > >Looking for suggestions. I have an ordered list of names these names will > >be reordered. I am looking to make a plot, graph, wi

Re: clusters of numbers

2018-12-15 Thread Vincent Davis
Why not start with a histogram. Vincent On Sat, Dec 15, 2018 at 6:46 PM Marc Lucke wrote: > hey guys, > > I have a hobby project that sorts my email automatically for me & I want > to improve it. There's data science and statistical info that I'm > missing, & I always enjoy reading about the p

Convert and analyze image data in a spreadsheet.

2020-06-11 Thread Vincent Davis
it in that color format? I think yes. 3. How can I visualize this data as a 6x6 color image and visualize each color on a gray scale. 4. General hints or link of how to proceed would be helpful. Thanks Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert and analyze image data in a spreadsheet.

2020-06-14 Thread Vincent Davis
Dennis, Thanks for your ideas. The researcher I am working with just told me the data is wrong and needs to send me new data and there are other problems with exactly what their research questions is. So this goes nowhere for now. Thanks Vincent Davis 720-301-3003 *Want to get a hold of me

How to match scipy.spatial.distance results back to pandas df

2020-07-16 Thread Vincent Davis
, 'euclidean') b = a[a < .0001] b array([8.83911760e-05, 6.31347765e-05, 3.89486842e-05, 2.13775583e-05, 2.10950231e-05, 4.10487515e-05, 6.7000e-05, 9.10878697e-05, 7.61183289e-05, 9.90050504e-05, 7.88162420e-05, 5.90931468e-05, 4.50111097e-05, 4.97393205e-05, 6.7896980

Re: Fake news Detect

2020-07-18 Thread Vincent Davis
Data Sceptic has a couple podcast and some of the code is open source. https://dataskeptic.com/blog/episodes/2018/algorithmic-detection-of-fake-news Thanks Vincent Davis 720-301-3003 *Want to get a hold of me?* *SMS: awesome.phone: ok...* *email: bad!* On Fri, Jul 17, 2020 at 11:39 PM Mike

Using pythons smtp server

2013-12-12 Thread Vincent Davis
initiate a SMTP server, send the attachment and shutdown the SMTP after. Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
ython have the ability to send emails without installing additional software or using an external server/service? Maybe I am wrong, I thought examples like s = smtplib.SMTP('localhost') ​​ are using a local(outside of python) smtp server, like postfix. Vincent Davis 720-301-3003 On Fri

Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
o send the email too. Then submit the email to that address using smtplib.SMTP ​Do I have that right? ​ Vincent Davis 720-301-3003 On Fri, Dec 13, 2013 at 10:24 AM, Dennis Lee Bieber wrote: > On Thu, 12 Dec 2013 18:01:58 -0700, Vincent Davis > declaimed the following: > > >I have

Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
Grant, Chris Thanks !!! I guess in the end this is a bad idea, (for my purposes) I should just use my gmail account smtp server. Vincent Davis 720-301-3003 On Fri, Dec 13, 2013 at 11:15 AM, Chris Angelico wrote: > On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis > wrote: > > Let me

Getting updates and restarting a long running url request.

2013-12-22 Thread Vincent Davis
7;-G 4 -E 1' blast_result = NCBIWWW.qblast("blastn", "nt", queryseq, megablast=True, entrez_query=e_query, word_size='11', other_advanced='-G 5 -E 2') return NCBIXML.read(blast_result) Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting updates and restarting a long running url request.

2013-12-26 Thread Vincent Davis
aiting on results. It will either give a result or possibly produce and error I suppose if the for example I lost the connection to the internet but I am not really sure about that. That said after some more research I found this tread. http://lists.open-bio.org/pipermail/biopython/2013-Apr

lookup xpath (other?) to value in html

2013-12-31 Thread Vincent Davis
. Any suggestions? Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: lookup xpath (other?) to value in html

2013-12-31 Thread Vincent Davis
efer to, given xpath what is the value (the opposite of what I want) Vincent Davis On Tue, Dec 31, 2013 at 6:45 PM, Jason Friedman wrote: > > I have a about 255 data fields that I am trying to verify on thousands of > > webpages. > > For example: > > value: 255,000 >

Re: lookup xpath (other?) to value in html

2013-12-31 Thread Vincent Davis
r some of the pages, I got this from the county on a cd, I thought defining the xpath would be easier using bs4 or http://lxml.de/ Vincent Davis 720-301-3003 On Tue, Dec 31, 2013 at 10:30 PM, Jason Friedman wrote: > > For example this URL; > > http://jeffco.us/ats/displaygeneral.

Re: Flip a graph

2014-01-04 Thread Vincent Davis
You might think about using an array to represent the canvas. Starting with it filled with "" and then for each point change it to "X". The print the rows of the array. You can make the array/canvas arbitrarily large and then plot multiple different paths onto the same array.

Re: Flip a graph

2014-01-04 Thread Vincent Davis
When printing the rows of the array/canvas you might add \n to the end of each row and print the canvas all at once rather than a print statement for each row. Vincent Davis 720-301-3003 On Sat, Jan 4, 2014 at 3:10 PM, Vincent Davis wrote: > You might think about using an array to repres

generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Vincent Davis
0: for j in range(1, p + 1): sequence = sequence + a[j] else: a = a[:t] + a[t - p] + a[t+1:] db(t + 1, p) for j in range(int(a[t - p]) + 1, k): a = a[:t] + str(j) + a[t+1:] db(t + 1, t)

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Vincent Davis
de_brujin(k, n) and the ordering the same ordering as found in ​de_brujin(k, n). I am not really sure how to modify the algorithm to do that. Any ideas? I won't have time to think hard about that until later. Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Vincent Davis
ence generated by itertools.permutations. Vincent Davis On Thu, Jan 23, 2014 at 10:18 AM, Dave Angel wrote: > > Vincent Davis Wrote in message: > > > (something about your message seems to make it unquotable) > > 64gig is 4^18, so you can forget about holding a string of size 4^50

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Vincent Davis
gt; db(t + 1, t) > db(1, 1) > return sequence.translate(_mapping) I am not really sure what _mapping should be. The code above does not run because NameError: global name '_mapping' is not defined I tried to get the bytearray ​ ​ sequence to convert to ascii but don

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Vincent Davis
te > type." > ​Thanks for pointing this out Mark, ​I will soon be running this on 3.3+ Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: generate De Bruijn sequence memory and string vs lists

2014-01-23 Thread Vincent Davis
100 loops, best of 3: 10.2 msec per loop This took ~4 secs (stop watch) which is much more that 10*.0102 Why is this? $ python3 -m timeit -s 'from debruijn_compat import debruijn_bytes as d' 'd(4, 11)' 10 loops, best of 3: 480 msec per loop​ This took ~20 secs vs .480*10 d(4, 14) takes about 24 seconds (one run) Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: generate De Bruijn sequence memory and string vs lists

2014-01-24 Thread Vincent Davis
tually plan to plot frequency (the number of times an observed sub sequence overlaps a value in the De Bruijn sequence) The way the sub sequences overlap is important to me and I don't see a way go from base-k (or any other base) to the index location in the De Bruijn sequence. i.e. a

Re: generate De Bruijn sequence memory and string vs lists

2014-01-24 Thread Vincent Davis
0 times -- until there's a run that takes > 0.2 secs or more. The total expected minimum time without startup overhead > is then > ​Ah, I did not know about the calibration. That and I did not notice the 100 on my machine vs 10 on yours.​ Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

manually build a unittest/doctest object.

2015-12-07 Thread Vincent Davis
t.Example(source="print('hello world')/n", want="hello world\n") t = doctest.DocTestRunner() t.run(e) Thanks Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: manually build a unittest/doctest object.

2015-12-08 Thread Vincent Davis
is into a test. doctest seemed the simplest but maybe there is a better way. I also tried something like: assert exec("""print('hello word')""") == 'hello word' Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: manually build a unittest/doctest object.

2015-12-08 Thread Vincent Davis
int('world') Exception raised: Traceback (most recent call last): File "/Users/vincentdavis/anaconda/envs/py35/lib/python3.5/doctest.py", line 1320, in __run compileflags, 1), test.globs) File "", line 1 print('hello') ^ SyntaxError: multiple statements found while compiling a single statement Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: manually build a unittest/doctest object.

2015-12-08 Thread Vincent Davis
urce code from a jupyter notebook. Reading closer this seems like it will work. Not that I mind learning more about how doctests work ;-) Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Try: rather than if :

2015-12-14 Thread Vincent Davis
except AttributeError: pass handle.write("\n") The specific use case I noticed this was https://github.com/biopython/biopython/blob/master/Bio/AlignIO/EmbossIO.py#L38 Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: Try: rather than if :

2015-12-14 Thread Vincent Davis
ributeError: raise try: name = handel.name write("# Report_file: %s\n" % name) except AttributeError: pass write("\n") Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: Try: rather than if :

2015-12-14 Thread Vincent Davis
On Mon, Dec 14, 2015 at 4:53 PM, Ian Kelly wrote: > > Except that catching an exception just to immediately re-raise it is > silly. This would be better: > > try: > name = handle.name > except AttributeError: > pass > else: > handle.write("# Report_file: %s\n" % name) ​Ya that would

Re: Catogorising strings into random versus non-random

2015-12-21 Thread Vincent Davis
e is one result as of now, ​which is an archive of this tread. If you search for any given word or even the phrase ​, for example​ "baby lions at play ​ " you get a much larger set of results ​ ~500​ . I assue there are many was to search google with python, this looks like one. https://pypi.python.org/pypi/google Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

unicodedata with chr() not the same between python 3.4 and 3.5

2015-12-22 Thread Vincent Davis
'Lu', 'Ll')))[945:965] >>> u 'ԡԢԣԤԥԦԧԨԩԪԫԬԭԮԯԱԲԳԴԵ' Python 3.4 >>> import unicodedata >>> u = ''.join(chr(i) for i in range(65536) if (unicodedata.category(chr(i)) in ('Lu', 'Ll')))[945:965] >>> u '

Re: x=something, y=somethinelse and z=crud all likely to fail - how do i wrap them up

2016-02-01 Thread Vincent Davis
se a dict was better. See the example here. https://github.com/vincentdavis/USAC_data/blob/master/tools.py#L24 Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

suggestions for VIN parsing

2014-12-25 Thread Vincent Davis
I would like to parse the VIN, frame and engine numbers found on this page (below). I don't really know any regex, I have looked a little at pyparsing. I have some other similar numbers to. I am looking for suggestions, which "tool" should I learn, how should I approach this. http://www.britishspar

Re: suggestions for VIN parsing

2014-12-25 Thread Vincent Davis
These are vintage motorcycles so the "VIN's" are not like modern VIN's these are frame numbers and engine number. I don't want to parse the page, I what a function that given a VIN (frame or engine number) returns the year the bike was made. Vincent Davis 720-301-3003

Re: suggestions for VIN parsing

2014-12-25 Thread Vincent Davis
Tim and Ben, Thanks for your input, I am working on it now and will come back when I have questions. Any comment on using pyparsing VS regex Vincent Davis 720-301-3003 On Thu, Dec 25, 2014 at 7:18 PM, Ben Finney wrote: > Vincent Davis writes: > > > I don't want to parse t

Re: suggestions for VIN parsing

2014-12-28 Thread Vincent Davis
#x27;t1956' elif 100 <= int(g[0]) <= 944 and g[0][0]=='0': # t1956: 0100 - 0944 return 't1956' elif g[0][0] == '0' and 945 <= int(g[0]) <= 5: # tp1957: 0945 - 05 return 'tp1957' elif g[0][0] == '0' and 6 <= int(g[0]) <= 20075: # tp1958: 06 - 020075 return 'tp1958' elif g[0][0] == '0' and 20076 <= int(g[0]) <= 29363: # tp1959: 020076 - 029363 return 'tp1959' elif g[0][0] == '0' and 29364 <= int(g[0]) <= 30424: # tp1960: 029364 - 030424 return 'tp1960' else: return None else: return None vin_test_list = ['101n', '500n', '234na', '15809NA', '25000', '32303', '44135', '56700', '70930', '0100', 'H11512', 'D15789', 'DU101'] for vin in vin_test_list: print(vin_to_year2(vin)) Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: suggestions for VIN parsing

2014-12-29 Thread Vincent Davis
e 1982 model year. > ​Ah , I had not looked close at that yet. I found a different more extensive site. http://www.britishonly.com/tech/joust/techtiptriumphmf.htm​ Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: suggestions for VIN parsing

2014-12-29 Thread Vincent Davis
, it would act as a kinda test, If I only expect one match and I get more than I likely have a problem, 2, I found a more extensive (maybe better) list of frame numbers <http://www.britishonly.com/tech/joust/techtiptriumphmf.htm>, I could see some overlapping although I have not looked real close yet. Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Merge/append CSV files with different headers

2014-03-24 Thread Vincent Davis
csv.DictReader(csvfilesin, delimiter=',') for r in rows: print(allHeaders.issuperset(r.keys())) outfile.writerow(r) Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: Merge/append CSV files with different headers

2014-03-24 Thread Vincent Davis
Thanks for the feedback. Vincent Davis 720-301-3003 On Mon, Mar 24, 2014 at 1:44 PM, Chris Angelico wrote: > On Tue, Mar 25, 2014 at 4:50 AM, Vincent Davis > wrote: > > I have several csv file I need to append (vertically). They have > different > > but overlapping

bz2.decompress as file handle

2014-05-18 Thread Vincent Davis
Bio.Affy import CelFile from bz2 import decompress, with open('Tests/Affy/affy_v3_ex.CEL.bz2', 'rb') as handle: cel_data = decompress(handle.read()) c = CelFile.read(cel_data) ​​ ​Thanks​ Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: bz2.decompress as file handle

2014-05-18 Thread Vincent Davis
ead()).decode('ascii')) Vincent Davis 720-301-3003 On Sun, May 18, 2014 at 8:32 PM, Tim Chase wrote: > On 2014-05-18 19:53, Vincent Davis wrote: > > I have a file compressed with bz2 and a function that expects a > > file handle. When I decompress the bz2 file I get a string (

Re: bz2.decompress as file handle

2014-05-18 Thread Vincent Davis
On Sun, May 18, 2014 at 9:44 PM, Ian Kelly wrote: > You can just use bz2.open: > > >>> with bz2.open('test.txt.bz2', 'rt', encoding='ascii') as f: > ... print(f.read()) > ​Thanks I like that better then my solution. ​ Vincent Davis 720

Re: Python regex exercise

2015-04-04 Thread Vincent Davis
On Sat, Apr 4, 2015 at 5:51 PM, Thomas 'PointedEars' Lahn < pointede...@web.de> wrote: > > Do anyone have good links to python regex or other python problems for > > beginners but with solution. > > > > Please mail me. > ​I recently found​ this https

using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Vincent Davis
I had been reading in a file like so. (python 3) with open(dfile, 'rb') as f: for line in f: ​line = line.decode('utf-8', 'ignore').split(',') ​How can I ​do accomplish decode('utf-8', 'ignore') when reading with DictReader() Vi

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Vincent Davis
: > print(row['fieldname']) > What you have seems to work, now I need to go find my strange symbols that are not ​'utf-8' and see what happens I was thought, that I had to open with 'rb' to use ​encoding? Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Vincent Davis
" "LEASE GREGPRU D ETERSPM " "LEASE GREGPRU D ¬ETERSPM " "979643" {'encoding': 'windows-1252', 'confidence': 0.5} "¦ " " " " " "¦ " "986979" {'encoding': 'windows-1252', 'confidence': 0.5} "WELLS FARGO &¢ COMPANY " "WELLS FARGO & COMPANY " "WELLS FARGO & COMPANY " "WELLS FARGO &¢ COMPANY " "994946" {'encoding': 'windows-1252', 'confidence': 0.5} OSSOSSO¬¬O " OSSOSSOO " OSSOSSOO " OSSOSSO¬¬O " "996535" Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

date from day (count) of year

2015-04-24 Thread Vincent Davis
How does one get the date given the day of a year. >>> dt.datetime.now().timetuple().tm_yday 114 How would I get the Date of the 114 day of 2014? Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: date from day (count) of year

2015-04-24 Thread Vincent Davis
On Fri, Apr 24, 2015 at 8:01 AM, Ian Kelly wrote: > >>> dt.date(2014, 1, 1) + dt.timedelta(114 - 1) > datetime.date(2014, 4, 24) > ​Thanks!​ Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

getting fieldnames from Dictreader before reading lines

2015-05-09 Thread Vincent Davis
) 97 except StopIteration: 98 pass ValueError: I/O operation on closed file. Thanks Vincent ​ Davis​ -- https://mail.python.org/mailman/listinfo/python-list

Re: getting fieldnames from Dictreader before reading lines

2015-05-09 Thread Vincent Davis
Not sure what I was doing wrong, it seems to work now. Vincent Davis 720-301-3003 On Sat, May 9, 2015 at 4:46 PM, Vincent Davis wrote: > I am reading a file with Dictreader and writing a new file. I want use the > fieldnames in the Dictwriter from the reader. See below How should I be &

Re: getting fieldnames from Dictreader before reading lines

2015-05-09 Thread Vincent Davis
hly messed up parts of your error messages. I am posting from google mail (not google groups). Kindly let me know if this email is also html. Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

assertRaises() help

2015-05-27 Thread Vincent Davis
ile "/Users/vmd/GitHub/pandas_vmd/pandas/util/testing.py", line 1640, in __exit__ raise AssertionError("{0} not raised.".format(name)) AssertionError: ValueError not raised. >From the docs maybe I should be using a "with" statement​. Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: assertRaises() help

2015-05-27 Thread Vincent Davis
On Wed, May 27, 2015 at 4:55 PM, Cameron Simpson wrote: > First, test your test by hand running: > > to_datetime('2015-02-29', coerce=False) > > _Does_ it raise ValueError? > ​Well that was not expected.​ Thanks Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

write csv to object and read into pandas

2015-10-14 Thread Vincent Davis
. with open(infile,"r") as fin: with open(outfile,"w") as fout: writer=csv.writer(fout) for row in csv.reader(fin): #do stuff to the row writer.writerow(row) df = pandas.csv_reader(outfile) Vincent Davis 72

Re: write csv to object and read into pandas

2015-10-15 Thread Vincent Davis
That worked, Thanks! Vincent Davis 720-301-3003 On Thu, Oct 15, 2015 at 6:11 AM, Peter Otten <__pete...@web.de> wrote: > Oscar Benjamin wrote: > > > On 15 October 2015 at 09:16, Peter Otten <__pete...@web.de> wrote: > >> > >> def preprocess(fi

Public key encryption example.

2015-11-18 Thread Vincent Davis
reading the message from a local file. Possibly using cryptography library elliptic-curve https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ec/#elliptic-curve-signature-algorithms Surly there is an example out there? Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: Public key encryption example.

2015-11-18 Thread Vincent Davis
Found an example, needs a little updating but then it works (appears to) in python 3.5. http://coding4streetcred.com/blog/post/Asymmetric-Encryption-Revisited-(in-PyCrypto) Vincent Davis 720-301-3003 On Wed, Nov 18, 2015 at 5:04 PM, Chris Angelico wrote: > On Thu, Nov 19, 2015 at 10:56

shorten "compress" long integer to short ascii.

2015-11-19 Thread Vincent Davis
My goal is to shorten a long integer into a shorter set of characters. Below is what I have which gets me about a 45-50% reduction. Any suggestion on how to improve upon this? I not limited to ascii but I didn't see how going to utf8 would help. The resulting string needs to be something I could ty

Re: shorten "compress" long integer to short ascii.

2015-11-20 Thread Vincent Davis
gt; backagain = decoder(short) > nlen = len(str(n)) > print (nlen, len(short), float(len(short))/nlen) > assert n==backagain, (n,short,b) > > test() > Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

speed up pandas calculation

2014-07-30 Thread Vincent Davis
x27;VDAY', 'VMONTH', 'VYEAR', 'MED1', 'MED2', 'MED3', 'MED4', 'MED5'] for col in col_init: if col not in keep_col: del df[col] if f[-3:] == 'csv' and f[-6:-4] in ('93', '94', '95', '96', '97', '98', '99', '00', '91', '02', '03', '04', '05'): drugs = drugs_98_05 elif f[-3:] == 'csv' and f[-6:-4] in ('06', '08', '09', '10'): drugs = drugs_current for n in drugs: df[n] = df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1) Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

Re: speed up pandas calculation

2014-07-30 Thread Vincent Davis
On Wed, Jul 30, 2014 at 6:28 PM, Vincent Davis wrote: > The real slow part seems to be > for n in drugs: > df[n] = > df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1) > ​I was wrong, this is fast, it was selecti

Re: speed up pandas calculation

2014-07-30 Thread Vincent Davis
= df[keep_col] is not fast but it is not that slow. You made me think of a solution to that part. just slice and copy. The only gotya is that the keep_col have to actually exist keep_col = ['PATCODE', 'PATWT', 'VDAYR', 'VMONTH', 'MED1', 'MED2', 'MED3', 'MED4', 'MED5'] df = df[keep_col] The real slow part seems to be for n in drugs: df[n] = df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1) Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list

understanding nested lists?

2009-01-24 Thread Vincent Davis
I have a short peace of code that is not doing what I expect. when I assign a value to a list in a list alist[2][4]=z this seems replace all the 4 elements in all the sub lists. I assume it is supposed to but this is not what I expect. How would I assign a value to the 4th element in the 2nd sublis

Re: understanding nested lists?

2009-01-24 Thread Vincent Davis
Thanks for the info. I did not know that. Thanks Vincent Davis On Sat, Jan 24, 2009 at 10:46 AM, Steve Holden wrote: > Vincent Davis wrote: > > I have a short peace of code that is not doing what I expect. when I > > assign a value to a list in a list alist[2][4]=z this se

print formating for matrix/table

2009-01-26 Thread Vincent Davis
ne. I would have thought I could find a prebuilt function to do this. Surly lots of people are printing matrixes and would like nice formating. So what am I missing? Vincent Davis 720-301-3003 -- http://mail.python.org/mailman/listinfo/python-list

Re: print formating for matrix/table

2009-01-26 Thread Vincent Davis
best solution, convert the list to an array before printing? Thanks Vincent Davis On Mon, Jan 26, 2009 at 5:23 PM, Robert Kern wrote: > On 2009-01-26 18:18, Vincent Davis wrote: > >> I have a list of listsa matrix in that all sub lists are the same >> length. I there a ni

Re: print formating for matrix/table

2009-01-26 Thread Vincent Davis
csv formated for excel but that is for later I was just trying to make it easier to debug my code. Thanks Vincent Davis 720-301-3003 On Mon, Jan 26, 2009 at 7:03 PM, Robert Kern wrote: > On 2009-01-26 19:53, Vincent Davis wrote: > >> I do have numpy but am using lists as did

regular expression, help

2009-01-27 Thread Vincent Davis
I think there are two parts to this question and I am sure lots I am missing. I am hoping an example will help meI have a html doc that I am trying to use regular expressions to get a value out of. here is an example or the line Parcel ID: 39-034-15-009 I want to get the number "39-034-15-009" aft

regular expression, help

2009-01-27 Thread Vincent Davis
I think there are two parts to this question and I am sure lots I am missing. I am hoping an example will help meI have a html doc that I am trying to use regular expressions to get a value out of. here is an example or the line Parcel ID: 39-034-15-009 I want to get the number "39-034-15-009" aft

Re: How many followers of comp.lang.python

2009-01-27 Thread Vincent Davis
am a beginner programer and new to python it is really help to have a place to ask quick or long questions. Books are nly so good, Google helps but it doesn't debug code for you. Thanks Vincent Davis On Tue, Jan 27, 2009 at 10:13 AM, Grant Edwards wrote: > On 2009-01-27, Bruno Desth

Re: regular expression, help

2009-01-27 Thread Vincent Davis
is BeautifulSoup really better? Since I don't know either I would prefer to learn only one for now. Thanks Vincent Davis On Tue, Jan 27, 2009 at 10:39 AM, MRAB wrote: > Vincent Davis wrote: > >> I think there are two parts to this question and I am sure lots I am >>

change syntax coloring in IDLE

2009-01-27 Thread Vincent Davis
I am using mac with python 2.5.2 and IDLE verison 1.2.2. in the help it states I can change he text coloring by using "Configure IDLE" but I not sure what this is. It's not sn the menu, running Configure does nothing. How do I change the color (text and background) Thanks Vincen

Re: change syntax coloring in IDLE

2009-01-27 Thread Vincent Davis
f IDLE.app? That last part is ugh! Thanks Vincent Davis On Tue, Jan 27, 2009 at 12:40 PM, Ned Deily wrote: > In article > <77e831100901270950i6b0b510chf80a495a65ca9...@mail.gmail.com>, > Vincent Davis wrote: > > I am using mac with python 2.5.2 and IDLE verison 1.2.2.

Re: change syntax coloring in IDLE

2009-01-27 Thread Vincent Davis
using terminal and opening"In Vincent's case (EPD), this would be /Library/Frameworks/Python/Versions/Current/bin/idle2.5" Worked!! Thanks for the help. Vincent Davis On Tue, Jan 27, 2009 at 2:42 PM, Robert Kern wrote: > On 2009-01-27 13:40, Ned Deily wrot

program organization question

2009-01-28 Thread Vincent Davis
results as different names. I don't even know how to pass data from on program to another although I think I can figure this out. Any guidance? Thanks Vincent Davis -- http://mail.python.org/mailman/listinfo/python-list

question about Z=[[x for y in range(1,2) if AList[x]==y] for x in range(0,5)]

2009-02-01 Thread Vincent Davis
Z=[[x for y in range(1,2) if AList[x]==y] for x in range(0,5)] I am not sure how to ask this but which "for" is looped first? I could test but was wondering if there was a nice explanation I could apply to future situations. Thanks Vincent Davis 720-301-3003 -- http://mail.python.o

faster scipy.percentileofscore ?

2009-02-02 Thread Vincent Davis
Vincent Davis 720-301-3003 -- http://mail.python.org/mailman/listinfo/python-list

Re: faster scipy.percentileofscore ?

2009-02-02 Thread Vincent Davis
Did not know about http://www.scipy.org/Mailing_Lists but did not look, Thanks for the help Vincent Davis On Mon, Feb 2, 2009 at 11:28 AM, Robert Kern wrote: > On 2009-02-02 12:08, Vincent Davis wrote: >> >> Currently I am using the following: >> pgrades = [scipy.perce

Use list name as string

2009-02-04 Thread Vincent Davis
to ext1 = '\.csv' flex = filename + ext1 datawrite = csv.writer(open(flex, "wb")) datawrite.writerows(dataname) Thanks Vincent Davis -- http://mail.python.org/mailman/listinfo/python-list

Re: Use list name as string

2009-02-04 Thread Vincent Davis
would be 1,2,3,5,6,9,234 this parts works Thanks Vincent Davis 720-301-3003 On Wed, Feb 4, 2009 at 9:48 AM, Tim Chase wrote: > I know this is wrong it uses the items in the list as the filename, >> how do I refer to the dataname and not the items in it. >> > > Witho

Re: Use list name as string

2009-02-04 Thread Vincent Davis
I know nothing but that sucks. I can think of a lot of times I would like to do something similar. There really is no way to do this, it seems like there would be some simple way kind of like str(listname) but backwards or different. Thanks Vincent Davis On Wed, Feb 4, 2009 at 10:07 AM, MRAB

Re: Use list name as string

2009-02-04 Thread Vincent Davis
I guess what I am saying is that it does not seem like I am adding any information that is not already there when I have to enter that list and list name after all they are the same. Thanks Vincent Davis On Wed, Feb 4, 2009 at 10:18 AM, Vincent Davis wrote: > I know nothing but that sucks

  1   2   >