Sorry, the image can't displayed normally.

It's like:

To combine horizontally two DataFrames df1 and df2 with matching index:
import pandas as pd

df1 = pd.DataFrame
<https://www.skytowner.com/explore/pandas_dataframe_constructor>({'A':[1,2,3],
'B':[4,5,6]})
df2 = pd.DataFrame
<https://www.skytowner.com/explore/pandas_dataframe_constructor>({'C':[7,8,9],
'D':[10,11,12]})

df_concat = pd.concat
<https://www.skytowner.com/explore/pandas_concat_method>([df1, df2], axis=1)
df_concat
A B C D
0 1 4 7 10
1 2 5 8 11
2 3 6 9 12

Concatenate two matrices horizontally.

Create two matrices, and horizontally append the second matrix to the first
by using square bracket notation.

A = [1 2; 3 4]

A = *2×2*

     1     2
     3     4


B = [4 5 6; 7 8 9]

B = *2×3*

     4     5     6
     7     8     9


C = [A,B]

C = *2×5*

     1     2     4     5     6
     3     4     7     8     9



Reference:
[1]
https://www.skytowner.com/explore/concatenating_dataframes_horizontally_in_pandas
[2] https://www.mathworks.com/help//matlab/ref/double.horzcat.html
[3]
https://people.revoledu.com/kardi/tutorial/LinearAlgebra/HorzConcatenation.html

Xiangwei Wei <wxw19981...@gmail.com> 于2023年2月6日周一 15:06写道:

> I investigated two typical situation like DataFrame in Pandas and Matrix
> in Matlab.
> They both expresses this as horizontally concatenation.
>
> [image: image.png]
>
> [image: image.png]
>
> [image: image.png]
>
> Jialin Qiao <qiaojia...@apache.org> 于2023年2月6日周一 15:03写道:
>
>> +1 for Plan A: Rename it as HorizontallyConcatOperator.
>> —————————————————
>> Jialin Qiao
>> Apache IoTDB PMC
>>
>> Xiangwei Wei <wxw19981...@gmail.com> 于2023年2月6日周一 14:35写道:
>> >
>> > VerticallyConcatOperator is used to horizontally concatenate TsBlocks
>> with
>> > the same timestamp column. For example,
>> > TsBlock A is:
>> > | Time | ColumnA |
>> > |    1    |     1.0    |
>> > TsBlock B is:
>> > | Time | ColumnB |
>> > |    1    |       2.0    |
>> > After the VerticallyConcatOperator, the result will be:
>> > | Time | ColumnA | ColumnB |
>> > |    1    |       1.0    |     2.0      |
>> >
>> > Literally, I think it's a horizontal concatenation. So I suggest rename
>> it
>> > as HorizontallyConcatOperator.
>> >
>> > However, I asked the author about the reason for this name. He said,
>> "From
>> > the view of a table, adding columns means vertical changes."
>> >
>> > What's your opinion?
>> >
>> > +1 for Plan A: Rename it as HorizontallyConcatOperator.
>> > +1 for Plan B: Keep current name VerticallyConcatOperator.
>> >
>> > --
>> > Best,
>> > Xiangwei Wei
>>
>
>
> --
> Best,
> Xiangwei Wei
>


-- 
Best,
Xiangwei Wei

Reply via email to