Dataframe Rows Sorting - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Dataframe Rows Sorting (/thread-14573.html) |
Dataframe Rows Sorting - stranger14u - Dec-07-2018 How to sort dataframe rows horizontally from lowest to the highest for an example I have This To This 1 3 2 8 5 -->1 2 3 5 8 3 2 4 8 6 -->2 3 4 6 8 2 6 3 7 9 -->2 3 6 7 9 5 3 7 9 6 -->3 5 6 7 9 7 2 4 8 6 -->2 4 6 7 8 2 6 5 7 9 -->2 5 6 7 9 | | 20000 lines long. Thanx. RE: Dataframe Rows Sorting - scidam - Dec-17-2018 You can do this easily using numpy, e.g. import numpy as np import pandas as pd result = np.sort(your_dataframe.values, axis=1) sorted_dataframe = pd.DataFrame(result) |