Loading tutorials
pd.read_csv. It explains why pandas leaves some columns as object when you expected numbers or dates. The next chapters cover the fixes. Here the goal is to diagnose the cause.5 min readdf["col"], and read a CSV with pandas. You should also have seen df.dtypes and know why text columns show up as object. Here you learn the general-purpose conversion tool, astype, and where it stops being the right choice.5 min readastype, pd.to_numeric and pd.to_datetime. It assumes you can index a DataFrame and Series, read a CSV with pd.read_csv, and write basic Python and simple regular expressions. It also assumes you have inspected your dtypes and kno5 min readobject columns are and how astype behaves, both covered earlier in this tutorial. Here you will learn how pd.to_numeric turns text into numbers, what its errors setting does, and where it can qui5 min readdatetime64 columns with pd.to_datetime, and how to avoid the usual traps: ambiguous day and month order, mixed formats, time zones, and values that silently become NaT.7 min readpd.to_numeric and pd.to_datetime with errors="coerce". The goal is to make sure no value disappears without you noticing.6 min readpd.read_csv, and use astype and pd.to_numeric as covered earlier in this tutorial. You should also be comfortable with df.dtypes. Here you will learn how to keep missing values in a column without changing the column'5 min readstr methods on a text column. You should also know that a pandas column with the dtype object holds arbitrary Python objects, usually strings. Earlier chapters covered astype, string cleaning and nullable dtypes5 min readcategory dtype: how pandas stores it, how to convert to it, and the behaviors that surprise people. It assumes you can load a DataFrame, check dtypes with df.dtypes, and convert a column with astype. It also assumes you know that missing values appear as NaN.5 min readpd.read_csv is often shorter and safer than repairing columns afterwards. It also avoids losing information, such as the leading zero in a zip code, before you can react5 min readpd.read_csv, and use df.dtypes. It also assumes you know the earlier chapters' tools: astype, pd.to_numeric, and the idea of nullable dtypes such as Int64. Here you will learn what convert_dtypes does, what it leaves alone, 5 min readdf.dtypes, and convert columns with astype and pd.to_numeric. It also assumes you know the category dtype from earlier in this tutorial. Memory work6 min read