Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 8:51 PM, Reto wrote: out = df.to_csv(None) new = pd.read_csv(io.StringIO(out), index_col=0) Thank you, brother. It works -- https://mail.python.org/mailman/listinfo/python-list

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Reto
On Mon, Apr 06, 2020 at 06:29:01PM -0400, Luca wrote: > so, given a dataframe, how do I make it print itself out as CSV? read the docs of to_csv... > And given CSV data in my clipboard, how do I paste it into a Jupiter cell > (possibly along with a line or two of code) that will create a datafram

Re: Multiprocessing queue sharing and python3.8

2020-04-06 Thread Israel Brewster
> On Apr 6, 2020, at 12:19 PM, David Raymond wrote: > > Attempting reply as much for my own understanding. > > Are you on Mac? I think this is the pertinent bit for you: > Changed in version 3.8: On macOS, the spawn start method is now the default. > The fork start method should be considered u

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 3:03 PM, Christian Gollwitzer wrote: CSV is the most sensible option here. It is widely supported by spreadsheets etc. and easily copy/pasteable. Thank you Christian. so, given a dataframe, how do I make it print itself out as CSV? And given CSV data in my clipboard, how do I

Re: Multiprocessing queue sharing and python3.8

2020-04-06 Thread Israel Brewster
> On Apr 6, 2020, at 12:27 PM, David Raymond wrote: > > Looks like this will get what you need. > > > def some_complex_function(x): >global q >#stuff using q > > def pool_init(q2): >global q >q = q2 > > def main(): >#initalize the Queue >mp_comm_queue = mp.Queue() > >

RE: Multiprocessing queue sharing and python3.8

2020-04-06 Thread David Raymond
Looks like this will get what you need. def some_complex_function(x): global q #stuff using q def pool_init(q2): global q q = q2 def main(): #initalize the Queue mp_comm_queue = mp.Queue() #Set up a pool to process a bunch of stuff in parallel pool = mp.Pool

RE: Multiprocessing queue sharing and python3.8

2020-04-06 Thread David Raymond
Attempting reply as much for my own understanding. Are you on Mac? I think this is the pertinent bit for you: Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Christian Gollwitzer
Am 06.04.20 um 17:17 schrieb Luca: On 4/6/2020 4:08 AM, Reto wrote: Does this help? Thank you, but not really. What I am trying to achieve is to have a way to copy and paste small yet complete dataframes (which may be the result of previous calculations) between a document (TXT, Word, Google

Introduction to PyLiveUpdate: A runtime python code manipulation framework

2020-04-06 Thread 0xcc
Hi everyone, I would like to introduce PyLiveUpdate (https://github.com/devopspp/pyliveupdate), a tool that helps you modify your running python code without stopping and restarting it. This is helpful when you want to add some code (like print for debug) or modify a function definition (like

Multiprocessing queue sharing and python3.8

2020-04-06 Thread Israel Brewster
Under python 3.7 (and all previous versions I have used), the following code works properly, and produces the expected output: import multiprocessing as mp mp_comm_queue = None #Will be initalized in the main function mp_comm_queue2=mp.Queue() #Test pre-initalized as well def some_complex_funct

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 4:08 AM, Reto wrote: Does this help? Thank you, but not really. What I am trying to achieve is to have a way to copy and paste small yet complete dataframes (which may be the result of previous calculations) between a document (TXT, Word, GoogleDoc) and Jupiter/IPython. Did I m

[RELEASE] Python 2.7.18 release candidate 1

2020-04-06 Thread Benjamin Peterson
Greetings, 2.7.18 release candidate 1, a testing release for the last release of the Python 2.7 series, is now available for download. The CPython core developers stopped applying routine bugfixes to the 2.7 branch on January 1. 2.7.18 will includes fixes that were made between the release of 2.

Re: Exceptions versus Windows ERRORLEVEL

2020-04-06 Thread Stephen Tucker
Thanks, Eryk - this is very helpful. Stephen. On Mon, Apr 6, 2020 at 6:43 AM Eryk Sun wrote: > On 4/3/20, Stephen Tucker wrote: > > > > Does an exception raised by a Python 3.x program on a Windows machine set > > ERRORLEVEL? > > ERRORLEVEL is an internal state of the CMD shell. It has nothing

Re: Decorator with parameters

2020-04-06 Thread Chris Angelico
On Mon, Apr 6, 2020 at 6:36 PM ast wrote: > > Hello > > I wrote a decorator to add a cache to functions. > I realized that cache dictionnary could be defined > as an object attribute or as a local variable in > method __call__. > Both seems to work properly. > Can you see any differences between t

Decorator with parameters

2020-04-06 Thread ast
Hello I wrote a decorator to add a cache to functions. I realized that cache dictionnary could be defined as an object attribute or as a local variable in method __call__. Both seems to work properly. Can you see any differences between the two variants ? from collection import OrderedDict clas

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Reto
On Sat, Apr 04, 2020 at 07:00:23PM -0400, Luca wrote: > dframe.to_string > > gives: > > 0 a0 b0 c0 d0 > 1 a1 b1 c1 d1 > 2 a2 b2 c2 d2 > 3 a3 b3 c3 d3> That's not the output of to_string. to_string is a method, not an attribute which is apparent by the > comment in your output