This time I will talk about axis in Python (numpy and pandas).
axis = 0: Row direction (direction from row 01 to 02) → Vertical direction axis = 1: Column direction (direction from column A to B) → horizontal direction
Let's prepare two DataFrames in pandas. Now concat (concatenate data frames). From the above, we were able to confirm the function of axis.
References: A new data analysis textbook in Python (Official text of Python 3 engineer certification data analysis test) URL:https://cbt.odyssey-com.co.jp/pythonic-exam.html
Regarding axis, from basic operation of numpy to data frame concatenation of pandas It can be processed based on the above basic rules.
However, some of them are as follows. Thinking normally
If it is line (02), it will be deleted horizontally, so axis = 1 If it is column (B), it will be deleted vertically, so axis = 0
It may become.
In this case, it's just a nuance,
-Move in the row direction (vertical) and select the row you want to delete → axis = 0 -Move to the column direction (horizontal) and select the column you want to delete → axis = 1
It is good to think that.
Recommended Posts