NumPy Cookbook - Second Edition by Ivan Idris

NumPy Cookbook - Second Edition by Ivan Idris

Author:Ivan Idris [Ivan Idris]
Language: eng
Format: epub
Tags: Python
Publisher: Packt Publishing
Published: 2015-04-28T21:00:00+00:00


Whitespace of array elements is automatically trimmed on indexing

Whitespace at the ends of strings is also trimmed by comparison operators

Vectorized string operations are available, so loops are not needed

How to do it...

Let's create the character array:

Create the character array as a view:carray = np.array(html).view(np.chararray)

Expand tabs to spaces with the expandtabs() function. This function accepts the tab size as an argument. The value is 8 if not specified:carray = carray.expandtabs(1)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.