Python | Numpy expandtabs() method
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’]
Recommended Posts:
- Python 3 Strings | expandtabs() method
- Python String Methods | Set 3 (strip, lstrip, rstrip, min, max, maketrans, translate, replace & expandtabs())
- Python | numpy.ma.ids() method
- Python | numpy.busday_count() method
- Python | Numpy.broadcast_arrays() method
- Python | Numpy getmaskarray() method
- python | Numpy masked_equal() method
- Python | Numpy fromrecords() method
- Python | numpy.lookfor() method
- Python | numpy.printoptions() method
- Python | Numpy getmask() method
- Python | Numpy dstack() method
- Python | numpy.assert_allclose() method
- Python | Numpy.dsplit() method
- Python | Numpy fromarrays() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



