Re: When creating a nested dictionary of dataframes, how can I name a dictionary based on a list name of the dataframe?

2020-06-07 Thread Peter Otten
Aaron wrote: > When creating a nested dictionary of dataframes, how can I name a > dictionary based on a list name of the dataframe? > > Given the following: > > # START CODE > import pandas as pd > > cars = {'Brand': ['Honda Civic','Toyota Corolla'], > 'Price': [22000,25000] >

ctypes & allocated memory

2020-06-07 Thread Miki Tebeka
Hi, Does ctypes, when using restype, frees allocated memory? For example, will the memory allocated by "strdup" be freed after the "del" statement? If not, how can I free it? --- import ctypes libc = ctypes.cdll.LoadLibrary('libc.so.6') strdup = libc.strdup strdup.argtypes = [ctypes.c_char_p]

Re: ctypes & allocated memory

2020-06-07 Thread Miki Tebeka
> Does ctypes, when using restype, frees allocated memory? > > For example, will the memory allocated by "strdup" be freed after the "del" > statement? If not, how can I free it? I've tried the following program and I'm more confused now :) Can anyone explain the output? --- import ctypes im

Re: ctypes & allocated memory

2020-06-07 Thread Michael Torrie
On 6/7/20 7:15 AM, Miki Tebeka wrote: > Hi, > > Does ctypes, when using restype, frees allocated memory? > > For example, will the memory allocated by "strdup" be freed after the "del" > statement? If not, how can I free it? I don't think so. I did a quick google search and came up with this d

Re: Trouble with making modules 'global'

2020-06-07 Thread Peter J. Holzer
On 2020-06-04 04:18:31 -0400, Terry Reedy wrote: > On 6/3/2020 11:48 PM, pytho...@gmail.com wrote: > > (1) Main.py > > The PEP8 standard is all lower case for modules, leaving TitleCase for > classes, so, for instance, file/module 'editor' contains the definition of > class 'Editor' as its main cl

Re: Is there some reason that recent Windows 3.6 releases don't included executable nor msi installers?

2020-06-07 Thread Peter J. Holzer
On 2020-05-28 20:51:59 -0400, Terry Reedy wrote: > On 5/28/2020 5:20 PM, Peter J. Holzer wrote: [The final "security-only" releases are source-only] > > This seems a rather odd policy to me. > > Not if one considers the intended users. > Do you prefer we not make these releases? No, of couse no

Button press event - event handling and picking: IndexError: list index out of range

2020-06-07 Thread Caledonian26
I have the following command below. The overall aim is to allow the user to select a Y-value by pressing on the bar graph. The colour of each bar should then change depending on what this Y-value is. import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt

Re: ctypes & allocated memory

2020-06-07 Thread Barry
> On 7 Jun 2020, at 14:23, Miki Tebeka wrote: > > Hi, > > Does ctypes, when using restype, frees allocated memory? > > For example, will the memory allocated by "strdup" be freed after the "del" > statement? If not, how can I free it? See https://linux.die.net/man/3/strdup that tells you t

Re: When creating a nested dictionary of dataframes, how can I name a dictionary based on a list name of the dataframe?

2020-06-07 Thread Aaron
Thank you for the help! Based on your response/recommendation, I am thinking that my entire approach to solving my problem is very poor. I am trying to pull slices from a dataframe, store them in a nested dictionary, retrieve them, perform calculations, store the results in the same nested dictio

Re: Button press event - event handling and picking: IndexError: list index out of range

2020-06-07 Thread DL Neil via Python-list
On 8/06/20 7:06 AM, Caledonian26 wrote: ... However, I keep getting the error: IndexError: list index out of range. Could anyone give me a helping hand as to where I am going wrong? When things go wrong, Python tries to be helpful by providing a "traceback". Please copy-paste the entire tra

Re: Button press event - event handling and picking: IndexError: list index out of range

2020-06-07 Thread MRAB
On 2020-06-07 23:24, DL Neil via Python-list wrote: On 8/06/20 7:06 AM, Caledonian26 wrote: ... However, I keep getting the error: IndexError: list index out of range. Could anyone give me a helping hand as to where I am going wrong? When things go wrong, Python tries to be helpful by provi

Re: Button press event - event handling and picking: IndexError: list index out of range

2020-06-07 Thread DL Neil via Python-list
On 8/06/20 10:38 AM, MRAB wrote: On 2020-06-07 23:24, DL Neil via Python-list wrote: On 8/06/20 7:06 AM, Caledonian26 wrote: ... However, I keep getting the error: IndexError: list index out of range. Could anyone give me a helping hand as to where I am going wrong? When things go wrong, Py

Re: ctypes & allocated memory

2020-06-07 Thread Michael Torrie
On 6/7/20 2:25 PM, Barry wrote: >> Does ctypes, when using restype, frees allocated memory? >> >> For example, will the memory allocated by "strdup" be freed after the "del" >> statement? If not, how can I free it? > > See https://linux.die.net/man/3/strdup that tells you to use free() to delete

Re: ctypes & allocated memory

2020-06-07 Thread Miki Tebeka
Hi, > But the problem is that by specifying the type as ctypes.c_char_p, > ctypes will hide that pointer from you and return a Python object > instead. I'm not sure how ctypes is doing it under the hood, but I > suspect ctypes is doing it's own strdup of the string on conversion, and > managing t