-
-
Save amankharwal/f06e232a0d85071613b7e1ef9456dbf5 to your computer and use it in GitHub Desktop.
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
def contains_capitalized_word(s): | |
for w in s.split(): | |
if w.isupper(): | |
return True | |
return False | |
df["contains_capitalized"] = df["title"].apply(contains_capitalized_word) | |
value_counts = df["contains_capitalized"].value_counts().to_dict() | |
fig, ax = plt.subplots() | |
_ = ax.pie([value_counts[False], value_counts[True]], labels=['No', 'Yes'], | |
colors=['#003f5c', '#ffa600'], textprops={'color': '#040204'}, startangle=45) | |
_ = ax.axis('equal') | |
_ = ax.set_title('Title Contains Capitalized Word?') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment