Python Pandas strip blank spaces in string in Index

0 votes
Hi. I have a pandas dataframe in which the index has string with blank spaces. I want to remove the blank spaces. Like Python allows stripping for normal strings, Can I strip the Index strings?
May 14, 2019 in Python by Karan
2,591 views

1 answer to this question.

0 votes

Yes, you can string the blank spaces from the Dataframe index. Refer to the below code:

idx = pd.Index()
idx.str.strip()
answered May 14, 2019 by Raj

Related Questions In Python

0 votes
2 answers

Finding the index of a character in python string

You can use word.find('o') as well to ...READ MORE

answered Jun 1, 2018 in Python by george
• 200 points
1,254 views
0 votes
1 answer

String.strip() in Python

If you can comment out code and ...READ MORE

answered Oct 22, 2018 in Python by SDeb
• 13,300 points
579 views
–1 vote
1 answer
0 votes
1 answer

How to remove blank spaces from Python string?

You can use the strip method to do ...READ MORE

answered Apr 4, 2019 in Python by Rishi
843 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,070 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,491 views
0 votes
1 answer

Removing blank spaces on the right in Pandas Dataframe index

First, get the index of the dataframe ...READ MORE

answered May 14, 2019 in Python by Suraj
2,761 views
0 votes
1 answer

Python Pandas: Find length of string in dataframe

You can find the length of the ...READ MORE

answered May 14, 2019 in Python by Firoz
6,386 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP