Essential Basic Functionality

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

This page covers the operations you use on every Series and DataFrame regardless of where the data comes from: looking at it, doing arithmetic between objects, summarising it, applying functions, changing its labels, sorting it and converting its dtypes. It follows the structure of the official "Essential basic functionality" guide, updated for pandas 3.

This page targets pandas 3.1 (3.1.0 was released on 22 October 2026) on Python 3.13 or 3.14; pandas 3.1 supports Python 3.11 and requires NumPy 2.0.2 or later. Every example was run on pandas 3.1.0, NumPy 2.5.4 and Python 3.13, and the output shown is real. Examples assume import numpy as np and import pandas as pd. Related pages: Series, DataFrame, Index Objects, Data Types Overview, Group By and User-Defined Functions.

All the examples on this page use the same small frame, built with a seeded random generator:

import numpy as np
import pandas as pd

rng = np.random.default_rng(42)
df = pd.DataFrame(
    {"a": rng.integers(0, 10, 6), "b": rng.normal(size=6).round(2), "c": list("xyxzyx")},
    index=pd.date_range("2026-10-01", periods=6),
)
print(df)
            a     b  c
2026-10-01  0  0.94  x
2026-10-02  7 -1.95  y
2026-10-03  6 -1.30  x
2026-10-04  4  0.13  z
2026-10-05  4 -0.32  y
2026-10-06  8 -0.02  x

Head, tail and attributes

print(df.head(2))        # first two rows (default 5)
print(df.tail(-4))       # all rows except the first four; a negative n means "all but"
print(df.dtypes.to_dict())
print(df.shape, df.index.dtype)
            a     b  c
2026-10-01  0  0.94  x
2026-10-02  7 -1.95  y
            a     b  c
2026-10-05  4 -0.32  y
2026-10-06  8 -0.02  x
{'a': dtype('int64'), 'b': dtype('float64'), 'c': <StringDtype(na_value=nan)>}
(6, 3) datetime64[us]

The attributes shape, size, ndim, dtypes, index, columns, axes and empty are cheap and do not copy data. df.dtypes shows <StringDtype(na_value=nan)> for the default str dtype: it is the same dtype that prints as str.

The underlying data: array and to_numpy

print(df[["a", "b"]].to_numpy().dtype)                 # float64: int64 and float64 columns are upcast
print(df[["a", "b"]].to_numpy().flags.writeable)       # True: mixed dtypes need a new array
print(df[["a"]].to_numpy().flags.writeable)            # False: a view of the data, read-only
print(df.to_numpy().dtype)                             # object: numbers and strings together
float64
True
False
object

to_numpy() returns a NumPy array whose dtype is the lowest common denominator of the columns; it is a copy only when pandas has to build a new array. Under Copy-on-Write a view is returned read-only, so writing through it cannot change the frame by accident. Use to_numpy(copy=True) when you need a writable array. Series.array returns the data as stored (an ExtensionArray). Prefer both over .values, which returns a NumPy array for some dtypes and an ExtensionArray for others.

pandas can use two optional libraries to accelerate some operations: bottleneck (some reductions with NaN) and numexpr (large arithmetic expressions and eval/query). Both are in the performance install extra. Disable them with pd.set_option("compute.use_bottleneck", False) and pd.set_option("compute.use_numexpr", False) when you need bit-for-bit reproducibility.

Flexible binary operations

DataFrame with Series and with scalars

By default a Series combined with a DataFrame is aligned on the columns; the method forms take an axis argument.

df2 = pd.DataFrame({"a": [1, 2, 3, 4], "b": [10.0, 20, 30, 40]})
print(df2 + df2.iloc[0])               # the first row is broadcast down every row
print(df2.sub(df2["a"], axis="index"))  # the "a" column is broadcast across the columns
     a     b
0  2.0  20.0
1  3.0  30.0
2  4.0  40.0
3  5.0  50.0
   a     b
0  0   9.0
1  0  18.0
2  0  27.0
3  0  36.0

The method equivalents are add, sub, mul, div, truediv, floordiv, mod, pow and the reversed forms radd, rsub, rmul, rdiv, rfloordiv, rmod, rpow (df.rsub(10) computes 10 - df). Dividing by zero produces inf (for example 1 / pd.Series([0, 1]) gives inf and 1.0), consistent with NumPy floats.

Missing data in arithmetic

NaN propagates through arithmetic. fill_value replaces a value that is missing on one side before the operation:

p = pd.DataFrame({"a": [1, 2], "b": [3, 4]}, index=["x", "y"])
q = pd.DataFrame({"b": [10, 20], "c": [1, 1]}, index=["y", "z"])
print(p + q)
print(p.add(q, fill_value=0))
    a     b   c
x NaN   NaN NaN
y NaN  14.0 NaN
z NaN   NaN NaN
     a     b    c
x  1.0   3.0  NaN
y  2.0  14.0  1.0
z  NaN  20.0  1.0

Comparisons and boolean reductions

Comparisons (==, !=, <, <=, >, >= and the methods eq, ne, lt, le, gt, ge) return boolean objects with the same labels. any(), all() and sum() reduce them:

print(df2 > 2)
print(df2.gt(2).all())                       # per column: a False, b True
print((df2 > 2).any().tolist(), (df2 > 2).sum().tolist())    # [True, True] [2, 4]
print(df2.equals(df2.copy()), (df2 == df2).all().all())      # True True
print((pd.Series([1, np.nan]) == pd.Series([1, np.nan])).tolist())   # [True, False]
print(pd.Series([1, np.nan]).equals(pd.Series([1, np.nan])))          # True
       a     b
0  False  True
1  False  True
2   True  True
3   True  True
a    False
b     True
dtype: bool
[True, True] [2, 4]
True True
[True, False]
True

Two notes. First, == treats NaN as unequal to itself, whereas equals() considers NaNs in the same location equal and also checks dtype and labels. Second, comparing two objects with different labels raises ValueError: Can only compare identically-labeled Series objects; align them first. A Series in an if raises ValueError: The truth value of a Series is ambiguous: use .any(), .all(), .empty or .item().

Combining overlapping data

combine_first patches the gaps of one object with values from another, aligning on labels:

d1 = pd.DataFrame({"a": [1, np.nan, 3], "b": [np.nan, 2, np.nan]})
d2 = pd.DataFrame({"a": [10, 20, 30, 40], "b": [1, 1, 1, 1]})
print(d1.combine_first(d2))
      a    b
0   1.0  1.0
1  20.0  2.0
2   3.0  1.0
3  40.0  1.0

DataFrame.combine(other, func) applies a binary function column by column (func receives two Series and returns a Series) and update modifies a frame in place with the non-missing values of another. For key-based combinations use merge and join (see Merge & Join).

Descriptive statistics

Reductions are methods on Series and DataFrames: count, sum, mean, median, min, max, std, var, sem, skew, kurt, quantile, prod, cumsum, cumprod, cummax, cummin, idxmin, idxmax, mode, nunique, corr and cov.

num = df[["a", "b"]]
print(num.sum().to_dict(), num.mean().round(3).to_dict())
print(num.sum(axis=1).tolist())                          # across columns, one value per row
print(num["b"].idxmax(), num["b"].idxmin())             # labels of the extremes
print(num.std(ddof=0).round(3).to_dict(), num.var().round(3).to_dict())   # ddof=1 is the default
print(num.quantile([0.25, 0.75]))
print(num.corr().round(3))
print(num.agg(["min", "max", "mean"]).round(2))
{'a': 29.0, 'b': -2.52} {'a': 4.833, 'b': -0.42}
[0.94, 5.05, 4.7, 4.13, 3.68, 7.98]
2026-10-01 00:00:00 2026-10-02 00:00:00
{'a': 2.609, 'b': 0.952} {'a': 8.167, 'b': 1.087}
         a       b
0.25  4.00 -1.0550
0.75  6.75  0.0925
       a      b
a  1.000 -0.684
b -0.684  1.000
         a     b
min   0.00 -1.95
max   8.00  0.94
mean  4.83 -0.42

Parameters shared by most reductions:

Parameter Meaning

axis

0 (default) reduces down the rows giving one value per column; 1 reduces across the columns

skipna

True (default) ignores missing values; False propagates them

numeric_only

restrict the reduction to numeric and boolean columns, avoiding string concatenation by sum

min_count

minimum number of non-missing values required; otherwise the result is NaN (for sum and prod)

ddof

delta degrees of freedom for std and var; the pandas default is 1 (the sample), NumPy’s is 0

level

removed in 2.0: use groupby(level=...)

The sum of an empty or all-missing Series is 0.0 (the empty sum), unless you pass min_count=1 to get NaN. pd.Series([1, None]).sum() skips the missing value and returns 1.0.

describe, value_counts and unique values

print(df.describe())
print(df.describe(percentiles=[0.1, 0.9]).loc[["10%", "90%"]])
print(df["c"].describe())
print(df["c"].value_counts())
print(df["c"].value_counts(normalize=True).round(2).to_dict())
print(df["c"].unique(), df["c"].nunique(), df["c"].mode().tolist())
              a         b
count  6.000000  6.000000
mean   4.833333 -0.420000
std    2.857738  1.042823
min    0.000000 -1.950000
25%    4.000000 -1.055000
50%    5.000000 -0.170000
75%    6.750000  0.092500
max    8.000000  0.940000
       a      b
10%  2.0 -1.625
90%  7.5  0.535
count     6
unique    3
top       x
freq      3
Name: c, dtype: object
c
x    3
y    2
z    1
Name: count, dtype: int64
{'x': 0.5, 'y': 0.33, 'z': 0.17}
<ArrowStringArray>
['x', 'y', 'z']
Length: 3, dtype: str 3 ['x']

describe summarises numeric columns only unless you pass include="all" or a list of dtypes (include=["number"], include=["str"]); exclude removes some. For non-numeric data it reports count, unique, top and freq. value_counts returns a Series called count (called proportion with normalize=True) sorted by frequency; sort=False keeps the order of appearance and dropna=False counts the missing values. unique() returns an array in order of appearance (here an ArrowStringArray, because the dtype is str).

Discretization: cut and qcut

cut bins values into intervals you choose; qcut bins them into quantiles of equal count.

ages = pd.Series([3, 17, 25, 40, 65, 90])
print(pd.cut(ages, bins=[0, 18, 65, 120]).tolist())
print(pd.cut(ages, [0, 18, 65, 120], labels=["child", "adult", "senior"]).tolist())
print(pd.cut(ages, [0, 18, 65, 120], right=False).tolist()[:3])
print(pd.qcut(ages, 3, labels=["lo", "mid", "hi"]).tolist())
[Interval(0, 18, closed='right'), Interval(0, 18, closed='right'), Interval(18, 65, closed='right'), Interval(18, 65, closed='right'), Interval(18, 65, closed='right'), Interval(65, 120, closed='right')]
['child', 'child', 'adult', 'adult', 'adult', 'senior']
[Interval(0, 18, closed='left'), Interval(0, 18, closed='left'), Interval(18, 65, closed='left')]
['lo', 'lo', 'mid', 'mid', 'hi', 'hi']

Intervals are right-closed by default: 18 falls in (0, 18]. Pass right=False for left-closed intervals, include_lowest=True to include the lowest edge, and an integer instead of a list to let cut choose equal-width bins. Both functions return a category Series (see Categorical Data).

Applying functions

Four families cover almost every case. The right one depends on whether the function takes a whole object, a row or column, or one element.

flowchart TD A[Function to apply] --> B{What does it receive?} B -- the whole DataFrame --> P[pipe] B -- a column or a row --> C{What does it return?} B -- one element --> M[Series.map or DataFrame.map] C -- one value per column --> AGG[agg or apply] C -- same shape as the input --> T[transform or apply] C -- several values --> AP[apply with result_type] A --> V{Can it be a vectorised expression?} V -- yes --> X["Use it directly: column arithmetic or np.where"]

pipe: functions of the whole object

pipe passes the object as the first argument, so user functions chain as readably as built-in methods:

def add_n(frame, n):
    return frame.assign(a=frame["a"] + n)

print(df.pipe(add_n, 1).pipe(lambda d: d[d["a"] > 3]).shape)    # (5, 3)

apply: column-wise or row-wise

DataFrame.apply(func, axis=0) calls func on each column (a Series); axis=1 calls it on each row. The result is a Series, a DataFrame or a scalar depending on what func returns.

num = df[["a", "b"]]
print(num.apply(np.sqrt).round(2).head(2))                  # one value per element: a DataFrame
print(num.apply(np.sum))                                    # one value per column: a Series
print(num.apply(lambda r: r["a"] * r["b"], axis=1).round(2).head(2))     # one value per row
print(num.apply(lambda s: pd.Series({"lo": s.min(), "hi": s.max()})))    # a Series per column: a DataFrame
print(num.apply(lambda s: [s.min(), s.max()], result_type="expand"))    # a list per column, expanded
               a     b
2026-10-01  0.00  0.97
2026-10-02  2.65   NaN
a    29.00
b    -2.52
dtype: float64
2026-10-01     0.00
2026-10-02   -13.65
Freq: D, dtype: float64
    a     b
lo  0 -1.95
hi  8  0.94
   a     b
0  0 -1.95
1  8  0.94

apply(axis=1) is a Python loop over rows and is slow on large frames. If the same result can be written as column arithmetic (df["a"] * df["b"]), do that. apply also accepts engine="numba" for numeric functions (see Enhancing Performance) and raw=True to pass NumPy arrays instead of Series.

agg and transform

agg (alias aggregate) reduces; transform keeps the shape. Both accept a function, a function name, a list or a dict by column.

print(num.agg({"a": ["sum"], "b": ["mean", "std"]}).round(2))
print(num.transform(lambda s: s - s.mean()).round(2).head(2))
         a     b
sum   29.0   NaN
mean   NaN -0.42
std    NaN  1.04
               a     b
2026-10-01 -4.83  1.36
2026-10-02  2.17 -1.53

transform really shines after a groupby, where it returns a result aligned with the original rows (for example group means for centering); see Group By: Split-Apply-Combine.

map: element by element

Series.map accepts a dict, a Series or a function; DataFrame.map applies a function to every cell. DataFrame.applymap was removed in pandas 3.0.

print(df["c"].map({"x": 1, "y": 2}).tolist())                    # [1.0, 2.0, 1.0, nan, 2.0, 1.0]
print(df["c"].map("{}!".format).tolist()[:2])                    # ['x!', 'y!']
print(num.map(lambda v: f"{v:.1f}").head(2))
[1.0, 2.0, 1.0, nan, 2.0, 1.0]
['x!', 'y!']
              a     b
2026-10-01  0.0   0.9
2026-10-02  7.0  -1.9

With a dict (or Series) lookup, keys that are missing give NaN, so the integer result becomes float. Pass na_action="ignore" to leave existing NaNs alone instead of passing them to the function.

Reindexing and altering labels

reindex conforms to a new index (new labels filled with NaN); drop, rename, set_axis and friends change labels without moving data. The full Index toolbox is on Index Objects.

r = df[["a", "b"]].reindex(
    index=pd.date_range("2026-10-02", periods=3).append(pd.DatetimeIndex(["2026-11-01"])),
    columns=["b", "z"],
)
print(r)
               b   z
2026-10-02 -1.95 NaN
2026-10-03 -1.30 NaN
2026-10-04  0.13 NaN
2026-11-01   NaN NaN
print(df.drop(columns="c").columns.tolist(), df.drop(index=df.index[:5]).shape)     # ['a', 'b'] (1, 3)
print(df.drop(columns=["zz"], errors="ignore").shape)                                # (6, 3)
try:
    df.drop(columns="zz")
except KeyError as e:
    print("KeyError", e)                       # KeyError "['zz'] not found in axis"
print(df.rename(columns=str.upper).columns.tolist())                                # ['A', 'B', 'C']
print(df.add_prefix("x_").columns.tolist(), df.set_axis(["p", "q", "r"], axis=1).columns.tolist())
print(df.rename_axis("when").index.name)                                            # when
  • rename with a dict ignores labels that do not exist (pass errors="raise" to fail); with a function it maps every label.

  • drop raises KeyError for missing labels unless errors="ignore".

  • set_axis(labels, axis=...) replaces all labels and returns a new object.

  • All of these return new objects. The inplace=True form is deprecated in pandas 3.1 (warning Pandas4Warning referencing PDEP-8), so reassign: df = df.rename(columns=...).

Iteration

Iterating over a Series yields values; over a DataFrame, column labels. Use items, itertuples and, last, iterrows.

for lbl, ser in list(num.items())[:1]:
    print(lbl, ser.dtype)                                  # a int64
print(list(num.itertuples(name="Row"))[0])                 # Row(Index=Timestamp('2026-10-01 00:00:00'), a=0, b=0.94)

pandas documents iteration as slow and usually avoidable: prefer vectorised expressions, then apply, then itertuples. Do not modify an object while iterating over it. The old iteritems was removed in 2.0; use items.

Sorting

print(df.sort_values(["c", "a"], ascending=[True, False]).head(3))
print(df.sort_values("a", key=lambda s: -s).head(2)["a"].tolist())    # [8, 7]
print(df.sort_values("a", kind="stable")["a"].tolist())                # [0, 4, 4, 6, 7, 8]
print(df.sort_values("a", ignore_index=True).index.tolist())            # [0, 1, 2, 3, 4, 5]
print(df.nlargest(2, "b")["b"].tolist(), df["b"].nsmallest(2).tolist())
print(pd.Series(["b", "A", "c"]).sort_values().tolist())                # ['A', 'b', 'c']
print(pd.Series(["b", "A", "c"]).sort_values(key=lambda s: s.str.lower()).tolist())   # ['A', 'b', 'c']
            a     b  c
2026-10-06  8 -0.02  x
2026-10-03  6 -1.30  x
2026-10-01  0  0.94  x
[8, 7]
[0, 4, 4, 6, 7, 8]
[0, 1, 2, 3, 4, 5]
[0.94, 0.13] [-1.95, -1.3]
['A', 'b', 'c']
['A', 'b', 'c']

sort_values(by, ascending, na_position, kind, ignore_index, key) sorts by one or several columns (a list of booleans gives per-column direction); sort_index(axis, ascending, level) sorts by labels. key receives a Series and returns the values to sort by, which gives case-insensitive or natural orders. kind="stable" (or "mergesort") keeps the original order of ties, which matters when you sort twice. nlargest and nsmallest are faster than a full sort for the top few rows. Missing values go last by default (na_position="first" reverses that).

Dtypes

Each column has one dtype. df.dtypes lists them, df.dtypes.value_counts() counts them by kind.

t = pd.DataFrame({
    "i": [1, 2], "f": [1.5, 2.5], "s": ["a", "b"], "b": [True, False],
    "d": pd.to_datetime(["2026-10-01", "2026-10-02"]),
    "cat": pd.Categorical(["u", "v"]), "n": pd.array([1, None], dtype="Int64"),
})
print(t.dtypes)
i               int64
f             float64
s                 str
b                bool
d      datetime64[us]
cat          category
n               Int64
dtype: object

The default dtype of strings is str (pandas 3.0), of datetimes datetime64[us] and of integers with missing values float64 unless you ask for the nullable Int64. The full catalogue is on Data Types Overview.

Choosing columns by dtype

print(t.select_dtypes(include="number").columns.tolist())              # ['i', 'f', 'n']
print(t.select_dtypes(include=["str"]).columns.tolist())               # ['s']
print(t.select_dtypes(exclude=["number", "bool"]).columns.tolist())    # ['s', 'd', 'cat']
print(t.select_dtypes("datetime").columns.tolist(), t.select_dtypes("category").columns.tolist())

select_dtypes(include="object") also returns str columns in pandas 3.x but emits a Pandas4Warning: "For backward compatibility, 'str' dtypes are included by select_dtypes when 'object' dtype is specified". Pass "str" explicitly (or "string" for the pd.NA-based dtype) and drop "object" when you mean strings.

astype and conversion

print(t.astype({"i": "float64", "s": "string"}).dtypes.to_dict())
try:
    pd.Series(["1", "x"]).astype("int64")
except ValueError as e:
    print("ValueError", e)                                  # invalid literal for int() with base 10: 'x'
print(pd.to_numeric(pd.Series(["1", "x"]), errors="coerce").tolist())     # [1.0, nan]
print(pd.to_numeric(pd.Series(["1", "2"]), downcast="integer").dtype)     # int8
print(pd.Series([1.5]).astype("int64").tolist())                          # [1]  truncates toward zero
print(pd.Series([300]).astype("int8").tolist())                           # [44]  wraps silently
print(pd.Series([1, np.nan]).astype("Int64").tolist())                    # [1, <NA>]
try:
    pd.Series([np.nan, 1.0]).astype("int64")
except Exception as e:
    print(type(e).__name__)                                              # IntCastingNaNError
  • astype converts one Series or several columns (with a dict) and returns a new object. Casting strings to numbers needs clean strings; use pd.to_numeric(errors="coerce") to turn bad values into NaN (the errors="ignore" choice was removed in 3.0).

  • Casting floats to integers truncates; casting between integer sizes wraps silently (the NumPy behaviour). Check the range first or use downcast in to_numeric.

  • IntCastingNaNError means the data contains NaN or infinity: use Int64, or fill first.

  • convert_dtypes() converts to the nullable dtypes (Int64, Float64, boolean, string). infer_objects() re-infers the types of object columns.

  • Mixed data stays object: pd.Series([1, 2.5, "a"]).dtype and pd.Series([1, True]).dtype are both object.

Smaller dtypes save memory: a 1,000-element int64 Series occupies 8,132 bytes with deep=True including the index and 1,132 bytes as int8.

Setting values and upcasting

pandas 3 does not silently change a column’s dtype when you assign an incompatible value (PDEP-6):

s = pd.Series([1, 2, 3])
try:
    s.iloc[0] = 1.5
except TypeError as e:
    print(e)                      # Invalid value '1.5' for dtype 'int64'
s = s.astype("float64")
s.iloc[0] = 1.5                   # works

Copies and Copy-on-Write

Methods that return a new object (assign, rename, sort_values, astype…​) never modify the original, and a subset or derived object never writes through to its parent. The defensive .copy() calls found in older code are rarely required. Chained assignment (df["a"][mask] = 0) cannot work and raises a ChainedAssignmentError warning; write df.loc[mask, "a"] = 0 instead. See Copy-on-Write and DataFrame.

Method chaining

Because methods return new objects, long transformations read as one expression:

res = (
    df.assign(ratio=lambda d: d["b"] / d["a"].replace(0, np.nan))
    .query("a > 2")
    .loc[:, ["a", "ratio"]]
    .round(2)
    .sort_index(ascending=False)
)
print(res)
            a  ratio
2026-10-06  8  -0.00
2026-10-05  4  -0.08
2026-10-04  4   0.03
2026-10-03  6  -0.22
2026-10-02  7  -0.28

Callables passed to assign, loc, query-style methods and pipe receive the intermediate frame, so no temporary variable is needed. pandas 3 adds pd.col expressions for the same purpose (see pd.col, select & filter).

Display options

Options control how objects print, not the values.

print(pd.get_option("display.max_rows"), pd.get_option("display.precision"))     # 60 6
with pd.option_context("display.precision", 2):
    print(pd.DataFrame({"x": [1 / 3, 2 / 3]}))
60 6
      x
0  0.33
1  0.67

pd.option_context restores the previous value on exit. The complete list is on Options & Settings.

Pitfalls

  • Alignment surprises: arithmetic and assignment align on labels; a mismatch gives NaN, not an error.

  • Row-wise apply: apply(axis=1) builds a Series per row and upcasts mixed dtypes to object. Prefer vectorised column operations.

  • Statistics defaults differ from NumPy: ddof=1 in pandas, ddof=0 in NumPy; pandas skips NaN by default, NumPy propagates it.

  • sum on mixed columns concatenates strings (pd.DataFrame({"a": [1, 2], "c": ["x", "y"]}).sum() gives a 3 and c xy); use numeric_only=True.

  • Integer overflow on astype wraps without a warning.

  • select_dtypes("object") includes str columns with a warning in pandas 3.

  • map with a dict turns unmapped values into NaN, changing the dtype.

  • value_counts naming: since pandas 2.0 the result is named count and its index carries the original name; in pandas 1.x the counts kept the original name and the index was called index, so old code that reads result["index"] fails.

Outdated statements in older books and tutorials

Older text says In pandas 3.1 Changed

df.applymap(f)

removed; df.map(f)

3.0 (January 2026)

df.drop(..., inplace=True), df.rename(..., inplace=True)

deprecated; reassign the result

3.1 (October 2026)

df.sum(level=0), df.groupby(axis=1)

removed; groupby(level=0).sum(), transpose first

2.0 and 3.0

pd.value_counts(x)

removed; x.value_counts()

3.0

df.append, Series.append

removed; pd.concat

2.0 (April 2023)

iteritems(), mad()

removed; items(), abs(x - x.mean()).mean()

2.0

pd.to_numeric(..., errors="ignore")

removed; use errors="coerce" or catch the exception

3.0

df.dtypes == object finds the text columns

text is str; use select_dtypes("str") or is_string_dtype

3.0

df.values for NumPy arrays

to_numpy(); the result may be read-only

3.0

SettingWithCopyWarning

removed; chained assignment is ignored and warned about

3.0

df.first("1M") and df.last("1M")

removed; slice with loc on the index

3.0