Maybe the question is wrong, what does it mean to merge on line 0?
There is also the merge function
I started the topic with such, I agree, not very clear question (because in another topic he already started to be stupid and twist the logic).
Почему строки вместо столбцов:
row = pd.concat([Input_Data.iloc[Stroka], Input_Info.iloc[Stroka]], axis=1)
But he understood everything correctly - what I want from the code
В коде, который вы предоставили, строки объединяются вместе с данными из Input_Data и Input_Info по горизонтали (ось 1),
а не по вертикали (ось 0), как это обычно бывает при использовании concat.
Параметр axis в функции concat позволяет указывать, по какой оси выполнять объединение данных. Когда axis=1,
объединение происходит по горизонтали, то есть данные сливаются по столбцам, а когда axis=0,
это означает объединение по вертикали, или по строкам.
Таким образом, в вашем коде строки (Stroka) объединяются с данными из Input_Data и Input_Info вдоль оси 1,
что приводит к тому, что данные соединяются в столбцы.
Well further, I said that the columns will not connect, as he understood it correctly, he suggested the reasons, and I asked for the code to check - in which the connection should occur, and he gave what I showed earlier.
mytarmailS #: Hmm... why is the index 0:1 if the string is one?
And there is such a crap that the range is often specified not up to the inclusive number, i.e. up to such and such a number, not inclusive. I just forgot about it when I was struggling with this topic.
And in R there is indexing from 1, as far as I understand.....
I started the topic with such, I agree, not a very clear question (since in another topic he had already started being obtuse and twisting logic).
But he understood everything correctly - what I want from the code
Well further, I said that the columns don't connect, as he understood it correctly, he suggested reasons, and I asked for the code to check - in which the connection should happen, and he gave what I showed earlier.
In my case then he should have suggested like this?
Did you find that in the documentation?
Anyway, I got this code from him:
And it works - but he did not explain to me the reason for this syntax!
Yes, this is correct too. The reason is that if you want to get a dataframe object, you have to pass a list of indexes, not a single index. Otherwise it will return a single series, which won't merge the way you expect because they have inverted indexing.
Maxim Dmitrievsky #: Yes, this is also correct. The reason is that if you want to get a datatyrame object, you have to pass a list of indexes, not a single index.
Why square brackets made it like a list from a variable is beyond me.
Maybe the question is wrong, what does it mean to merge on line 0?
There is also the merge functionI started the topic with such, I agree, not very clear question (because in another topic he already started to be stupid and twist the logic).
Почему строки вместо столбцов: row = pd.concat([Input_Data.iloc[Stroka], Input_Info.iloc[Stroka]], axis=1)But he understood everything correctly - what I want from the code
Well further, I said that the columns will not connect, as he understood it correctly, he suggested the reasons, and I asked for the code to check - in which the connection should occur, and he gave what I showed earlier.
The first lines can be done this way
In my case then it should have suggested this?
Got it. Because such indexing as you have returns pd.Series objects, not pd.Dataframe objects
I have shown above how to do it correctly
from zero to one, i.e. one
if you set one value, it will return another object with different indexing.
you can go from zero to two, and so on.
Did you find this in the documentation?
Anyway, I got this code from him:
row = pd.concat([Input_Data.iloc[[Stroka]], Input_Info.iloc[[Stroka]]], axis=1)And it works - but he did not explain to me the reason for this syntax!
Hmm... why is the index 0:1 if the string is one?
And there is such a crap that the range is often specified not up to the inclusive number, i.e. up to such and such a number, not inclusive. I just forgot about it when I was struggling with this topic.
And in R there is indexing from 1, as far as I understand.....I started the topic with such, I agree, not a very clear question (since in another topic he had already started being obtuse and twisting logic).
But he understood everything correctly - what I want from the code
Well further, I said that the columns don't connect, as he understood it correctly, he suggested reasons, and I asked for the code to check - in which the connection should happen, and he gave what I showed earlier.
In my case then he should have suggested like this?
Did you find that in the documentation?
Anyway, I got this code from him:
And it works - but he did not explain to me the reason for this syntax!
Yes, this is also correct. The reason is that if you want to get a datatyrame object, you have to pass a list of indexes, not a single index.
Why square brackets made it like a list from a variable is beyond me.
Why the square brackets made like a list from a variable is beyond me.
Because you created a list and put 1 object in it?)
That's what annoys me - variables change their types - transformers :)
That's what annoys me - variables change their types - transformers :)
Dynamic typing is called
It would be hard to switch to a C-like language after that.
Thanks for the clarification, a human is still more useful than a machine when it comes to learning!
Yeah, at least they did that - I use it a lot.
Yep, at least they did that - I use it a lot.
There is a book called "Python for Complex Problems", you can download it. It's well written about nampai and pandas.