class_docstr: Test common dtype coercion rules between concat and append.
class_docstr_tok: ["Test","common","dtype","coercion","rules","between","concat","and","append","."]
code: def test_concat_categorical_coercion_nan(self):
      # GH 13524
  
      # some edge cases
      # category + not-category => not category
      s1 = Series(
          np.array([np.nan, np.nan], dtype=np.float64), dtype="category"
      )
      s2 = Series([np.nan, 1])
  
      exp = Series([np.nan, np.nan, np.nan, 1])
      tm.assert_series_equal(
          pd.concat([s1, s2], ignore_index=True), exp
      )
      tm.assert_series_equal(s1._append(s2, ignore_index=True), exp)
  
      s1 = Series([1, np.nan], dtype="category")
      s2 = Series([np.nan, np.nan])
  
      exp = Series([1, np.nan, np.nan, np.nan], dtype="float")
      tm.assert_series_equal(
          pd.concat([s1, s2], ignore_index=True), exp
      )
      tm.assert_series_equal(s1._append(s2, ignore_index=True), exp)
  
      # mixed dtype, all nan-likes => not-category
      s1 = Series([np.nan, np.nan], dtype="category")
      s2 = Series([np.nan, np.nan])
  
      exp = Series([np.nan, np.nan, np.nan, np.nan])
      tm.assert_series_equal(
          pd.concat([s1, s2], ignore_index=True), exp
      )
      tm.assert_series_equal(s1._append(s2, ignore_index=True), exp)
      tm.assert_series_equal(
          pd.concat([s2, s1], ignore_index=True), exp
      )
      tm.assert_series_equal(s2._append(s1, ignore_index=True), exp)
  
      # all category nan-likes => category
      s1 = Series([np.nan, np.nan], dtype="category")
      s2 = Series([np.nan, np.nan], dtype="category")
  
      exp = Series([np.nan, np.nan, np.nan, np.nan], dtype="category")
  
      tm.assert_series_equal(
          pd.concat([s1, s2], ignore_index=True), exp
      )
      tm.assert_series_equal(s1._append(s2, ignore_index=True), exp)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import Categorical, DataFrame, Index, Series
  import pandas._testing
label_desc: Use image node_id 17 for calling the TestConcatAppendCommon obj's underlying member method code with example usage: obj.test_concat_categorical_coercion_nan() without return types