Reputation: 1601
An unusual question, in my remote docker environment linux gcc with python
2.7.6
sentence_case = {
'value': np.asscalar(working_df.subject.isin(working_df.subject.str.capitalize()).sum()),
'label': 'Sentence case'
}
correctly works and produces my array I am looking for, however in my local python anaconda distribution of the same version of 2.7.6, I get 'StringMethods' object has no attribute 'capitalize'
From what I've read on https://docs.python.org/2/library/stdtypes.html#string-methods this capitalize string method is "locale-dependent" which I'm not quite sure what that means but I can only conclude this is the reason for the error.
How should I go about error handling this or is there anything I can do to completely replicate the docker environment. Thanks for any help.
Upvotes: 0
Views: 1961
Reputation: 42885
The error message suggests that the result of the str
StringMethod
as applied to a pandas
Series
does not have the attribute capitalize - so I would be looking for issues with the pandas version rather than with the python
string
methods.
The locale dependency refers to location-specific application of these methods, not the availability of methods per se.
Upvotes: 2