Re: help: pandas and 2d table

2024-04-16 Thread jak via Python-list
Stefan Ram ha scritto: jak wrote or quoted: Stefan Ram ha scritto: df = df.where( df == 'zz' ).stack().reset_index() result ={ 'zz': list( zip( df.iloc[ :, 0 ], df.iloc[ :, 1 ]))} Since I don't know Pandas, I will need a month at least to understand these 2 lines of code. Thanks again.

Re: help: pandas and 2d table

2024-04-16 Thread jak via Python-list
Stefan Ram ha scritto: df = df.where( df == 'zz' ).stack().reset_index() result ={ 'zz': list( zip( df.iloc[ :, 0 ], df.iloc[ :, 1 ]))} Since I don't know Pandas, I will need a month at least to understand these 2 lines of code. Thanks again. --

Re: help: pandas and 2d table

2024-04-13 Thread Tim Williams via Python-list
On Sat, Apr 13, 2024 at 1:10 PM Mats Wichmann via Python-list < python-list@python.org> wrote: > On 4/13/24 07:00, jak via Python-list wrote: > > doesn't Pandas have a "where" method that can do this kind of thing? Or > doesn't it match what you are looking for? Pretty sure numpy does, but >

Re: help: pandas and 2d table

2024-04-13 Thread Mats Wichmann via Python-list
On 4/13/24 07:00, jak via Python-list wrote: Stefan Ram ha scritto: jak wrote or quoted: Would you show me the path, please?    I was not able to read xls here, so I used csv instead; Warning:    the script will overwrite file "file_20240412201813_tmp_DML.csv"! import pandas as pd with

Re: help: pandas and 2d table

2024-04-13 Thread jak via Python-list
Stefan Ram ha scritto: jak wrote or quoted: Would you show me the path, please? I was not able to read xls here, so I used csv instead; Warning: the script will overwrite file "file_20240412201813_tmp_DML.csv"! import pandas as pd with open( 'file_20240412201813_tmp_DML.csv', 'w' )as

help: pandas and 2d table

2024-04-12 Thread jak via Python-list
Hi everyone. I state that I don't know anything about 'pandas' but I intuited that it could do what I want. I get, through the "read_excel" method, a table similar to this: obj| foo1 foo2 foo3 foo4 foo5 foo6 --- foo1| aa ab zz ad ae af