Values-And-Index

Sat 17 May 2025

title: "Values and Index" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
datatype = [('one', 'int32'), ('two', 'int32')]
values = np.zeros(3, dtype = datatype)
currrent_index = ['Row '+str(i) for i in range(1, 4)]
df = pd.DataFrame(values, index = currrent_index)
df
one two
Row 1 0 0
Row 2 0 0
Row 3 0 0
df.shape
(3, 2)
df.ndim
2

Score: 5

Category: data-wrangling