Skip to content
Related Articles

Related Articles

Python | Numpy expandtabs() method

Improve Article
Save Article
Like Article
  • Last Updated : 19 Sep, 2019

With the help of numpy.char.expandtabs() method, we can expand the tab using numpy method in the single statement.

Syntax : numpy.char.expandtabs()

Return : Return the string array having expanded tabs.

Example #1 :

In this example we can see that by using numpy.char.expandtabs() method, we are able to get the expanded tabs by using numpy.




# import numpy
import numpy as np
  
# using numpy.char.expandtabs() method
gfg = np.char.expandtabs(['Geeks\tFor\tGeeks'], 10)
  
print(gfg)

Output :

[‘Geeks For Geeks’]

Example #2 :




# import numpy
import numpy as np
  
# using numpy.char.expandtabs() method
gfg = np.char.expandtabs(['G\tF\tG', 'Jitender\tKumar'], 20)
  
print(gfg)

Output :

[‘G F G’ ‘Jitender Kumar’]

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!