Horje
Reset Index & Retain Old Index as Column in pandas Code Example
Reset Index & Retain Old Index as Column in pandas
import pandas as pd

#define DataFrame
df = pd.DataFrame({'points': [25, 12, 15, 14, 19, 23, 25, 29],
                   'assists': [5, 7, 7, 9, 12, 9, 9, 4],
                   'rebounds': [11, 8, 10, 6, 6, 5, 9, 12]},
                   index=['A', 'C', 'D', 'B', 'E', 'G', 'F', 'H'])

#view DataFrame
print(df)

   points  assists  rebounds
A      25        5        11
C      12        7         8
D      15        7        10
B      14        9         6
E      19       12         6
G      23        9         5
F      25        9         9
H      29        4        12




Python

Related
[Solved] TypeError: 'NoneType' object is not subscriptable Code Example [Solved] TypeError: 'NoneType' object is not subscriptable Code Example
python :  read all the contents of the file into a string (use of  'with open') Code Example python : read all the contents of the file into a string (use of 'with open') Code Example
python default summary statistics for all columns Code Example python default summary statistics for all columns Code Example
python cd to file Code Example python cd to file Code Example
Using a generic exception block Code Example Using a generic exception block Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10