Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4358 from has2k1/sequence-string
FIX : cbook.is_sequence_of_strings behave better on array/pd.series of strings
- Loading branch information
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cbook.is_sequence_of_strings recognizes string objects | ||
`````````````````````````````````````````````````````` | ||
|
||
This is primarily how pandas stores a sequence of strings. | ||
|
||
import pandas as pd | ||
import matplotlib.cbook as cbook | ||
|
||
a = np.array(['a', 'b', 'c']) | ||
print(cbook.is_sequence_of_strings(a)) # True | ||
|
||
a = np.array(['a', 'b', 'c'], dtype=object) | ||
print(cbook.is_sequence_of_strings(a)) # True | ||
|
||
s = pd.Series(['a', 'b', 'c']) | ||
print(cbook.is_sequence_of_strings(s)) # True | ||
|
||
Previously, the last two prints returned false. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters