User Tools

Site Tools


programming:python:pandas

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
programming:python:pandas [2023/07/20 07:31] levorprogramming:python:pandas [2023/07/20 07:32] (current) levor
Line 13: Line 13:
 | columns.get_loc() | (example?) | get integer location of column, by its name | | columns.get_loc() | (example?) | get integer location of column, by its name |
 | index.get_loc() | (example?) | get integer location of row, by its name | | index.get_loc() | (example?) | get integer location of row, by its name |
-| .sort_values(column_name) | output_df = df.sort_values(col_name)\\ output_df = df.sort_values(by=[col_name_1, col_name_2, ...], ascending=True) | sort DataFrame by given colum(s)|+| .sort_values(column_name) | output_df = df.sort_values(col_name)\\ output_df = df.sort_values(by=[col_name_1, col_name_2, ...], ascending=True) | sort DataFrame by given column(s)\\ NOTE: row-titles also move, so use iloc instead of loc|
  
  
 import pandas  # pip install pandas import pandas  # pip install pandas
  
programming/python/pandas.txt · Last modified: 2023/07/20 07:32 by levor