numpy.char.capitalize

Original Documentation Return a copy of a with only the first character of each element capitalized. Calls str.capitalize element-wise. For 8-bit strings, this method is locale-dependent. Parameters: a: array_like of str or unicode: Input array of strings to capitalize. Returns: out: ndarray: Output array of str or unicode, depending on input types See also str.capitalize … Read more

Python Ternary Elif

Summary: To use an elif branch in the ternary operator, use another ternary operator as the result of the else branch (nested ternary operator). The nested ternary operator x if c0 else y if c1 else z returns x if condition c0 is met, else if (elif) condition c1 is met, it returns y, else … Read more

The World’s Most Concise Python Cheat Sheet

Do you want to learn Python but you’re overwhelmed and you don’t know where to start? Learn with Python cheat sheets! They compress the most important information in an easy-to-digest 1-page format. Here’s the new Python cheat sheet I just created—my goal was to make it the world’s most concise Python cheat sheet! ChrisWhile working … Read more

Python One Line Ternary

The most basic ternary operator x if c else y consists of three operands x, c, and y. It is an expression with a return value. The ternary operator returns x if the Boolean expression c evaluates to True. Otherwise, if the expression c evaluates to False, the ternary operator returns the alternative y. Ternary … Read more

Python One Line X

This is a running document in which I’ll answer all questions regarding the single line of Python code. If you want to become a one-liner wizard, check out my book “Python One-Liners”! πŸ™‚ This document contains many interactive code shells and videos to help you with your understanding. However, it’s pretty slow because of all … Read more