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
9 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
48 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
• 9,660 points
23 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
7 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
22 views
+4 votes
6 answers
0 votes
1 answer
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
12 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.