Sriswaroop Koundinya
Sriswaroop Koundinya

Reputation: 185

pd.RangeIndex function for some reason not working

I recently worked on a pandas dataframe and I wanted to change the indexes just for fun. This is the code:

price_of_items = pd.DataFrame({
"Wired Keyboard":["$7","4.3","12000"],"Wireless Keyboard":["$13","4.6","14000"]})
pd.RangeIndex(price_of_items,start=0,end=4,step=2)

This is the output without the pd.RangeIndex class: enter image description here But when I use the pd.RangeIndex, it is showing me an error. Thanks for all the help!!

Upvotes: 1

Views: 252

Answers (1)

Deepak
Deepak

Reputation: 707

price_of_items.index = pd.RangeIndex(start=0, stop=5, step=2)

Upvotes: 1

Related Questions