Skip to content

DataFrame Append to Concat

Documentation Index

Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt

Use this file to discover all available pages before exploring further.

Sourcery suggestion id: dataframe-append-to-concat

Section titled “Sourcery suggestion id: dataframe-append-to-concat”

Available starting with version 1.1.0

Use pandas.concat() instead of the deprecated DataFrame.append().

import pandas as pd
df = pd.DataFrame(
[
["Python", 190],
["JavaScript", 33],
],
columns=["Language", "Number of rules"],
)
other = pd.DataFrame([{"Language": "Java", "Number of rules": 5}])
df.append(other)
import pandas as pd
df = pd.DataFrame(
[
["Python", 190],
["JavaScript", 33],
],
columns=["Language", "Number of rules"],
)
other = pd.DataFrame([{"Language": "Java", "Number of rules": 5}])
pd.concat([df, other])

pandas.DataFrame.append() has been deprecated.

Use pandas.concat() instead.

See the DataFrame docs