RE: Problem with concatenating two dataframes

2021-11-08 Thread Schachner, Joseph
be shocked if you couldn't do it. Joseph S. Teledyne Confidential; Commercially Sensitive Business Data -Original Message- From: Mahmood Naderan Sent: Saturday, November 6, 2021 6:01 PM To: python-list@python.org; MRAB Subject: Re: Problem with concatenating two datafram

Re: Problem with concatenating two dataframes

2021-11-06 Thread Mahmood Naderan via Python-list
>The second argument of pd.concat is 'axis', which defaults to 0. Try >using 1 instead of 0. Unfortunately, that doesn't help... dict[name] = pd.concat( [dict[name],values], axis=1 ) {'dummy': Value M1  0 M2  0 M3  0, 'K1':Value  Value 0   10.0NaN 15.0NaN 2  

Re: Problem with concatenating two dataframes

2021-11-06 Thread MRAB
On 2021-11-06 20:12, Mahmood Naderan wrote: >Try this instead: > > >    dict[name] = pd.concat([dict[name], values]) OK. That fixed the problem, however, I see that they are concatenated vertically. How can I change that to horizontal? The printed dictionary in the end looks like {'dummy':

Re: Problem with concatenating two dataframes

2021-11-06 Thread Mahmood Naderan via Python-list
>Try this instead: > > >    dict[name] = pd.concat([dict[name], values]) OK. That fixed the problem, however, I see that they are concatenated vertically. How can I change that to horizontal? The printed dictionary in the end looks like {'dummy': Value M1  0 M2  0 M3  0, 'K1':

Re: Problem with concatenating two dataframes

2021-11-06 Thread MRAB
On 2021-11-06 16:16, Mahmood Naderan via Python-list wrote: In the following code, I am trying to create some key-value pairs in a dictionary where the first element is a name and the second element is a dataframe. # Creating a dictionary data = {'Value':[0,0,0]} kernel_df = pd.DataFrame(data,

Problem with concatenating two dataframes

2021-11-06 Thread Mahmood Naderan via Python-list
In the following code, I am trying to create some key-value pairs in a dictionary where the first element is a name and the second element is a dataframe. # Creating a dictionary data = {'Value':[0,0,0]} kernel_df = pd.DataFrame(data, index=['M1','M2','M3']) dict = {'dummy':kernel_df} # dummy  -