Invert pandas DataFrame upside down with just 15 characters without using a for statement

Target

Like this, I wanted to handle the data with the date in the newest order upside down in the date order. Of course, I had to look it up in English because it didn't come out easily in the Japanese source. .. .. Click here for Source

Click here for the blog that we run: Effort 1mm

2016-06-13  16910  16910  16620  16630   213980    16630
2016-06-10  17280  17280  17090  17180    67270    17180
2016-06-09  17340  17390  17190  17270    59900    17270
2016-06-08  17320  17440  17180  17440    56410    17440
2016-06-07  17250  17310  17140  17260    50000    17260
...           ...    ...    ...    ...      ...      ...
2001-08-24  11200  11250  11090  11180   227960    11180
2001-08-23  11430  11430  11100  11180   228950    11180
2001-08-22  11190  11490  11170  11380   184270    11380
2001-08-21  11320  11370  11150  11280   135740    11280
2001-08-20  11300  11350  11200  11270   170890    11270
2001-08-20  11300  11350  11200  11270   170890    11270
2001-08-21  11320  11370  11150  11280   135740    11280
2001-08-22  11190  11490  11170  11380   184270    11380
2001-08-23  11430  11430  11100  11180   228950    11180
2001-08-24  11200  11250  11090  11180   227960    11180
...           ...    ...    ...    ...      ...      ...
2016-06-15  16390  16590  16330  16520    92530    16520
2016-06-16  16460  16500  15970  16010   157200    16010
2016-06-17  16240  16350  16160  16180   140830    16180
2016-06-20  16460  16630  16450  16540    84920    16540
2016-06-21  16450  16800  16350  16760   136000    16760

Code to invert

data.iloc[::-1]

It ended with, lol When I actually hit it, I was surprised that it was switched up and down As usual, I don't really understand the mechanism of ** iloc **, ** loc **, etc., lol

Recommended Posts

Invert pandas DataFrame upside down with just 15 characters without using a for statement
Create a dataframe from excel using pandas
Python pandas: Search for DataFrame using regular expressions
A real way for people using python 3.8.0-2 from windows to work with multibyte characters
Extract N samples for each group with Pandas DataFrame
Convert from Pandas DataFrame to System.Data.DataTable using Python for .NET
[In one line] Visualize like a lawn with just Pandas
Building a pyhon environment without using Anaconda (with easy startup)
Turn an array of strings with a for statement (Python3)