Question: When updating one DataFrame based on info from second one the NaN's are not transferred.
With below code

```
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'A':[1,2,3,4,5], 'B':[4,5,6,7,8]})
df2 = pd.DataFrame({'A':[1,2,3], 'B':[7,np.nan,6]})
df1.update(df2)

```

The new DataFrame will look as below:

[![enter image description here](https://i.stack.imgur.com/2JbAm.png)](https://i.stack.imgur.com/2JbAm.png)

So the value from df2 is not transferred as this is a NaN

[![enter image description here](https://i.stack.imgur.com/MPJy5.png)](https://i.stack.imgur.com/MPJy5.png)

Normally this is probably an expected outcome but not in the particular case that I'm working on.
For the moment how I deal with it is that I replace all NaNs with a value or string that signalizes to me that it's something I need to check but I was wondering if there is an actual solution to pass the NaN as an update?

[![enter image description here](https://i.stack.imgur.com/bWc7H.png)](https://i.stack.imgur.com/bWc7H.png)

Answer: 
Try this,

```
bool isCountryChanged = false; // for update UI when country changed.

appBar: AppBar(
    backgroundColor: Colors.transparent,
    leading: const Icon(
      Icons.public,
      color: Colors.black,
      size: 27,
    ),
    title: const Text(
      "Kelime Öğren",
      style: TextStyle(color: Colors.black),
    ),
    elevation: 0,
    actions: [
      DropdownButton<String>(
        items: countryFlags
            .map((country, flag) {
              return MapEntry(
                  country,
                  DropdownMenuItem<String>(
                    value: flag,    
                    child: Text(flag, style: TextStyle(fontSize: 20),),
                  ));
            })
            .values
            .toList(),
        value: defaultFlag,
        onChanged: (String? country) {
          setState(() {
            defaultFlag = country!;
           isCountryChanged = true; });
           //  display circular indicator for 1 second.
         Future.delayed(Duration(milliseconds: 1000), () async {
             setState(() {
               isCountryChanged = false; });             
                  });
        },
      )
    ],
  ),
  body:isCountryChanged? CircularProgressIndicator( 
          valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
          strokeWidth: 5,
          );   : // do stuff

```
You can create a variable of type duration and then create a function which returns a future builder which is going to await for the duration to finish then display the country but in the mean time will display a circular indicator