On Thu, Jan 31, 2019 at 12:52 PM Chris Barker via Python-ideas < python-ideas@python.org> wrote:
I know that when I'm used to working with numpy and then need to do some string processing or some such, I find myself missing this "vectorization" -- if I want to do the same operation on a whole bunch of strings, why do I need to write a loop or comprehension or map?
Isn't what you want called "Pandas"? E.g.:
type(strs)
strs 0 Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec
strs.str.upper() 0 JAN 1 FEB 2 MAR 3 APR 4 MAY 5 JUN 6 JUL 7 AUG 8 SEP 9 OCT 10 NOV 11 DEC
strs.str.upper().str.count('A') 0 1 1 0 2 1 3 1 4 1 5 0 6 0 7 1 8 0 9 0 10 0 11 0
strs.str.replace('[aA]','X') 0 JXn 1 Feb 2 MXr 3 Xpr 4 MXy 5 Jun 6 Jul 7 Xug 8 Sep 9 Oct 10 Nov 11 Dec
-- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.