Re: JSON Object to CSV File Troubleshooting

2015-06-20 Thread Denis McMahon
On Thu, 18 Jun 2015 18:47:30 -0700, Sahlusar wrote: > I have a conundrum regarding JSON objects and converting them to CSV: I think your conundrum is that you've taken on a coding task beyond your abilities to comprehend, and as a result not only can you not code it, you can't even adequately d

Re: JSON Object to CSV File Troubleshooting

2015-06-20 Thread Denis McMahon
On Thu, 18 Jun 2015 18:47:30 -0700, Sahlusar wrote: > I have a conundrum regarding JSON objects and converting them to CSV: > > Context > > I am converting XML files to a JSON object (please see snippet below) > and then finally producing a CSV file. Here is a an example JSON object: This is wh

Re: JSON Object to CSV file

2015-06-20 Thread Denis McMahon
On Wed, 17 Jun 2015 08:00:11 -0700, Saran A wrote: > I would like to have this JSON object written out to a CSV file so that > the keys are header fields (for each of the columns) and the values are > values that are associated with each header field. > { > "CF": { ... > "CF": "Fee", Your js

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
On 6/20/2015 10:47 PM, Nasser M. Abbasi wrote: I did manage to find a way: - r1 =np.hstack([(v1,v2)]).T r2 =np.hstack([(v3,v4)]).T mat = np.vstack((r1,r2)) - Out[211]: array([[ 1, 4], [ 2, 5], [ 3, 6], [

Re: Time saving tips for Pythonists

2015-06-20 Thread Miki Tebeka
> What are your best time saving tips when programming Python? * Use the REPL. Write small chunks of code and test them as you go * Know what's available in the standard library (sets, Counter, deque ...) * Learn how to pick good packages from PyPI (community, last commit ...) * import this -- htt

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
On 6/20/2015 9:20 PM, MRAB wrote: Here's one way, one step at a time: r1 = np.concatenate([v1, v2]) r1 array([1, 2, 3, 4, 5, 6]) r2 = np.concatenate([v3, v4]) r2 array([ 7, 8, 9, 10, 11, 12]) m = np.array([r1, r2]) m array([[ 1, 2, 3, 4, 5, 6], [ 7, 8, 9, 10, 11, 12]])

Re: Opening PDF Using subprocess.Popen Failing

2015-06-20 Thread Naftali
On Friday, June 19, 2015 at 1:25:12 PM UTC-4, Naftali wrote: > It actually doesn't fail but it 'cannot open in protected mode' (see here > http://blogs.adobe.com/dmcmahon/2012/07/27/adobe-reader-cannot-open-protected-mode-due-to-a-problem-with-your-system-configuration/) > > I am using subprocess

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-20 Thread Rustom Mody
On Sunday, June 21, 2015 at 8:03:18 AM UTC+5:30, Chris Angelico wrote: > On Sun, Jun 21, 2015 at 11:59 AM, Rustom Mody wrote: > > Recent thread on python ideas > > https://mail.python.org/pipermail/python-ideas/2015-June/034177.html > > > > Since "python's immutable" ≠ "really immutable", we now ne

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-20 Thread Chris Angelico
On Sun, Jun 21, 2015 at 11:59 AM, Rustom Mody wrote: > Recent thread on python ideas > https://mail.python.org/pipermail/python-ideas/2015-June/034177.html > > Since "python's immutable" ≠ "really immutable", we now need a "really > immutable" That's because it requires mutable memory to keep tr

Re: How to construct matrix from vectors?

2015-06-20 Thread MRAB
On 2015-06-21 02:57, Nasser M. Abbasi wrote: I just started to learn some python today for first time, so be easy on me. I am having some trouble figuring how do the problem shown in this link http://12000.org/my_notes/mma_matlab_control/KERNEL/KEse44.htm Given 4 column vectors, v1,v2,v3,v4, e

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-20 Thread Rustom Mody
On Sunday, June 7, 2015 at 10:04:37 PM UTC+5:30, Chris Angelico wrote: > On Mon, Jun 8, 2015 at 2:20 AM, Rustom Mody wrote: > > Ok now rewrite that para above with > > s/tuple/numbers like 3 or 666/ > > So I put '3' on the ram and grind it to finest powder. > > Have all trinities (of religious or

How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
I just started to learn some python today for first time, so be easy on me. I am having some trouble figuring how do the problem shown in this link http://12000.org/my_notes/mma_matlab_control/KERNEL/KEse44.htm Given 4 column vectors, v1,v2,v3,v4, each is 3 rows. I want to use these to constru

HOPE: A Python just-in-time compiler for astrophysical computations

2015-06-20 Thread Mark Lawrence
Another beasty I've just stumbled across which you may find interesting http://www.sciencedirect.com/science/article/pii/S2213133714000687 -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/

Re: Classic OOP in Python

2015-06-20 Thread Mark Lawrence
On 19/06/2015 00:01, Laura Creighton wrote: In a message of Thu, 18 Jun 2015 11:50:28 +0100, Mark Lawrence writes: Throw in http://clonedigger.sourceforge.net/ as well and you've a really awesome combination. Mark Lawrence I didn't know about that one. Hey thank you, Mark. Looks great. It

Re: (unknown)

2015-06-20 Thread Ned Deily
In article <6264c933-0ed4-4055-baad-01b322bb6dd4@Calculus-Fantasticus-2.local>, Scott wrote: > We've been using a simple container implementation of a mathematical relation > (https://simple.wikipedia.org/wiki/Relation_(mathematics)) (i.e. an > invertible M:M mapping) for some time. [...] > Be

Re: JSON Object to CSV Question

2015-06-20 Thread Saran Ahluwalia
Here is the dictionary that corresponds with the CSV printed to the console: 1. { 2. "PAC": { 3. "Account": [{ 4. "PC": "0", 5. "CMC": "0", 6. "WC": "0", 7. "DLA": "0", 8. "CN": null, 9. "FC": { 10. "Int32": ["0", 11. "0", 12. "0", 13. "0", 14. "0"] 15

Re: Keypress Input

2015-06-20 Thread Michael Torrie
On 06/20/2015 09:02 AM, John McKenzie wrote: > > Guys, thanks for the various code examples for GPIO and the warning > about debouncing issues. I am still considering going the route of more > complex wiring and doing it a more traditional GPIO way. You can wire up the button without a little

Re: JSON Object to CSV Question

2015-06-20 Thread Ned Batchelder
On Saturday, June 20, 2015 at 2:10:51 AM UTC-4, Sahlusar wrote: > @Joonas: > > > The previous example was a typo. Please use the below example as a case > study.  > > > > > {'D_B': ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'], 'F_Int32': > ['0', '0', '0', '0', '0', '0', '0'

Re: Keypress Input

2015-06-20 Thread John McKenzie
Guys, thanks for the various code examples for GPIO and the warning about debouncing issues. I am still considering going the route of more complex wiring and doing it a more traditional GPIO way. -- https://mail.python.org/mailman/listinfo/python-list

Re: Relation: a new standard (PEP) container?

2015-06-20 Thread Ned Batchelder
On Saturday, June 20, 2015 at 2:10:50 AM UTC-4, Scott wrote: > We've been using a simple container implementation of a mathematical relation > (https://simple.wikipedia.org/wiki/Relation_(mathematics)) (i.e. an > invertible M:M mapping) for some time. > >   > We've been waiting for many years (d

Re: Keypress Input

2015-06-20 Thread John McKenzie
Christian, are you suggesting I learn to do everything perfectly before I ask how to do everything perfectly? Despite your tone and insults I honestly appreciate the response. I know what to focus on and less than 5 minutes from now I will be looking for e- books on the specific subjects you

Re: Working with jython in openSUSE 13.2

2015-06-20 Thread Cecil Westerhof
On Saturday 20 Jun 2015 15:01 CEST, Laura Creighton wrote: > In a message of Sat, 20 Jun 2015 12:58:33 +0200, Cecil Westerhof > writes: >> I installed Jython in openSUSE 13.2. But when calling jython I get: >> /usr/bin/build-classpath: error: JAVA_LIBDIR must be set >> Error: Could not find or loa

Re: Working with jython in openSUSE 13.2

2015-06-20 Thread Laura Creighton
In a message of Sat, 20 Jun 2015 12:58:33 +0200, Cecil Westerhof writes: >I installed Jython in openSUSE 13.2. But when calling jython I get: >/usr/bin/build-classpath: error: JAVA_LIBDIR must be set >Error: Could not find or load main class org.python.util.jython > >Does anyone have an ide

Working with jython in openSUSE 13.2

2015-06-20 Thread Cecil Westerhof
I installed Jython in openSUSE 13.2. But when calling jython I get: /usr/bin/build-classpath: error: JAVA_LIBDIR must be set Error: Could not find or load main class org.python.util.jython Does anyone have an idea what I need to do to get it working? -- Cecil Westerhof Senior Software En

Re: Catching exceptions with multi-processing

2015-06-20 Thread Fabien
On 06/20/2015 05:14 AM, Cameron Simpson wrote: I would keep your core logic Pythonic, raise exceptions. But I would wrap each task in something to catch any Exception subclass and report back to the queue. Untested example: def subwrapper(q, callable, *args, **kwargs): try: q.put( ('

Re: Catching exceptions with multi-processing

2015-06-20 Thread Fabien
On 06/19/2015 10:58 PM, Chris Angelico wrote: AIUI what he's doing is all the subparts of task1 in parallel, then all the subparts of task2: pool.map(task1, dirs, chunksize=1) pool.map(task2, dirs, chunksize=1) pool.map(task3, dirs, chunksize=1) task1 can be done on all of dirs in parallel, as

Re: instance as module

2015-06-20 Thread Steven D'Aprano
On Fri, 19 Jun 2015 07:29 pm, Robin Becker wrote: > I'm trying to overcome a recursive import issue in reportlab. > > Module reportlab.rl_config uses various sources (eg ~/.reportlab_settings) > to initialize various defaults eg canvas_basefontname. If a user wants to > utilize reportlab to set u