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 in Python by Karan
189 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 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
99 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,160 points
48 views
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 in Python by Rishi
24 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 223 views
+4 votes
6 answers
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 in Python by Suraj
20 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 in Python by Firoz
328 views