Loading tutorials
df["new"] = ... adds a column by assignment.2 min readdf["price"] < 5. You should also know that a comparison on a column returns a Series of True and False values, one per row.2 min readpd.to_datetime converts strings, which the previous chapters covered. Here you will use the .dt accessor to turn one datetime column into several feature columns.2 min readmap and replace do this. They differ in what they do with values you don't mention.2 min readnp.select. pandas marks missing numbers as NaN (not a number). A derived column inherits that gap in some operations and hides it in others.2 min readnp.select can label rows by condition. Binning is the same idea with less code: you give pandas the edges of the groups and it labels every value for you.2 min readgroupby for basic aggregation. It covers how to attach a group-level statistic to every row of the original DataFrame.2 min readdf["name"] = .... Once you have derived several columns, you often need to put them where readers expect them, give them clear names, and remove the ones you no longer need.2 min readdf["name"] = .... It explains why some assignments silently do nothing and how to avoid the warnings pandas raises about them.2 min readdf["col"] = ..., vectorized arithmetic, np.where/np.select, map, and apply. It gives you a way to pick among them.2 min read