How to do it...

Enter the following commands in a code cell:

df1 = pd.DataFrame([['Pen', 24, 2.39],
['Eraser', 32, 1.29],
['Sharpener', 12, 10.39],
['Pencil', 42, 0.59 ]],
index=[100024, 201024, 202034, 101122],
columns = ['item', 'inventory', 'unit_price'])
df2 = pd.DataFrame({'item': ('Pen', 'Eraser', 'Sharpener', 'Pencil'),
'inventory': (24, 32, 12, 42),
'unit_price': (2.39, 1.29, 10.39, 0.59)},
index=[100024, 201024, 202034, 101122])

This code shows how to generate two DataFrame objects containing essentially the same data, that could represent the inventory of an office supplies store.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset