Repository: plotly/plotly.py

Issue:
FutureWarning from pandas
A future warning about pandas DataFrame.append method being deprecated in future pandas releases, and to replace with pandas.concat methods. I found this warning in plotly/plotly.py/packages/python/plotly/plotly/express/_core.py:271 but there may be other places in plotly when DataFrame.append method is used.


Discussion:
I just stumbled across those annoying warnings as well. Seems like a good first issue to me, so I will start to work on this now. Dev environment is already set up and right now I am identifying the spots where those changes need to be applied.

I will keep you updated as soon as there is a first commit.

Resolving patch:
diff --git a/packages/python/plotly/plotly/express/_core.py b/packages/python/plotly/plotly/express/_core.py
--- a/packages/python/plotly/plotly/express/_core.py
+++ b/packages/python/plotly/plotly/express/_core.py
@@ -1634,7 +1634,7 @@ def aggfunc_continuous(x):
         df_tree["parent"] = df_tree["parent"].str.rstrip("/")
         if cols:
             df_tree[cols] = dfg[cols]
-        df_all_trees = df_all_trees.append(df_tree, ignore_index=True)
+        df_all_trees = pd.concat([df_all_trees, df_tree], ignore_index=True)
 
     # we want to make sure than (?) is the first color of the sequence
     if args["color"] and discrete_color:
diff --git a/packages/python/plotly/plotly/figure_factory/_county_choropleth.py b/packages/python/plotly/plotly/figure_factory/_county_choropleth.py
--- a/packages/python/plotly/plotly/figure_factory/_county_choropleth.py
+++ b/packages/python/plotly/plotly/figure_factory/_county_choropleth.py
@@ -86,7 +86,7 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
         columns=["State", "ST", "geometry", "FIPS", "STATEFP", "NAME"],
         index=[max(gdf.index) + 1],
     )
-    gdf = gdf.append(singlerow, sort=True)
+    gdf = pd.concat([gdf, singlerow], sort=True)
 
     f = 51515
     singlerow = pd.DataFrame(
@@ -103,7 +103,7 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
         columns=["State", "ST", "geometry", "FIPS", "STATEFP", "NAME"],
         index=[max(gdf.index) + 1],
     )
-    gdf = gdf.append(singlerow, sort=True)
+    gdf = pd.concat([gdf, singlerow], sort=True)
 
     f = 2270
     singlerow = pd.DataFrame(
@@ -120,19 +120,19 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
         columns=["State", "ST", "geometry", "FIPS", "STATEFP", "NAME"],
         index=[max(gdf.index) + 1],
     )
-    gdf = gdf.append(singlerow, sort=True)
+    gdf = pd.concat([gdf, singlerow], sort=True)
 
     row_2198 = gdf[gdf["FIPS"] == 2198]
     row_2198.index = [max(gdf.index) + 1]
     row_2198.loc[row_2198.index[0], "FIPS"] = 2201
     row_2198.loc[row_2198.index[0], "STATEFP"] = "02"
-    gdf = gdf.append(row_2198, sort=True)
+    gdf = pd.concat([gdf, row_2198], sort=True)
 
     row_2105 = gdf[gdf["FIPS"] == 2105]
     row_2105.index = [max(gdf.index) + 1]
     row_2105.loc[row_2105.index[0], "FIPS"] = 2232
     row_2105.loc[row_2105.index[0], "STATEFP"] = "02"
-    gdf = gdf.append(row_2105, sort=True)
+    gdf = pd.concat([gdf, row_2105], sort=True)
     gdf = gdf.rename(columns={"NAME": "COUNTY_NAME"})
 
     gdf_reduced = gdf[["FIPS", "STATEFP", "COUNTY_NAME", "geometry"]]


Test patch: