Score: 0.9045660904731496; Reported for: String similarity
Open both answers

Present in both answers;
Present only in the new answer;
Present only in the old answer;

The problem comes from the fact that `pairplot` only accepts some pandas types in the `PairGrid`: float or int, but not `Object` or `Int64` for exemple (at least for some versions of matplotlib and/or seaborn: 3.0.3 and 0.9.0 respectivly generates that error).

Using `.astype('float')` before plotting in the following exemple should solve the problem as `a.One` is set to `Int64` and `a.Two` is initially an `Object` type:

``` a = pd.DataFrame() a['One'] = [1, 3, 3, 2, 1] a['One']=a['One'].astype('Int64') a['Two'] = ['yes', 'yes', 'no', 'yes', 'no'] a['Two'] = np.where(a['Two'] == 'yes', 1, a['Two']) a['Two'] = np.where(a['Two'] == 'no', 0, a['Two']) a['One']=a['One'].astype('int') a['Two']=a['Two'].astype('int') sns.pairplot(a) plt.show() ```

Remark that if you have `NaN` in the dataframe, `float` is your only option as `Int64` accepts missing values but not the `Int` type.

Using `.astype('float')` before plotting in the following exemple should solve the problem as `a.One` is set to `Int64` and `a.Two` is initially an `Object` type:

``` a = pd.DataFrame() a['One'] = [1, 3, 3, 2, 1] a['One']=a['One'].astype('Int64') a['Two'] = ['yes', 'yes', 'no', 'yes', 'no'] a['Two'] = np.where(a['Two'] == 'yes', 1, a['Two']) a['Two'] = np.where(a['Two'] == 'no', 0, a['Two']) a['One']=a['One'].astype('int') a['Two']=a['Two'].astype('int') sns.pairplot(a) plt.show() ```

Remark that if you have `NaN` in the dataframe, `float` is your only option as `Int64` accepts missing values but not the `Int` type.

The problem comes from the fact that `pairplot` only accepts some pandas types in the `PairGrid`: float or int, but not `Object` or `Int64` for exemple (at least for some versions of matplotlib and/or seaborn: 3.0.3 and 0.9.0 respectivly generates that error).

Using `.astype('float')` before plotting in the following exemple should solve the problem as `a.One` is set to `Int64` and `a.Two` is initially an `Object` type:

``` a = pd.DataFrame() a['One'] = [1, 3, 3, 2, 1] a['One']=a['One'].astype('Int64') a['Two'] = ['yes', 'yes', 'no', 'yes', 'no'] a['Two'] = np.where(a['Two'] == 'yes', 1, a['Two']) a['Two'] = np.where(a['Two'] == 'no', 0, a['Two']) a['One']=a['One'].astype('int') a['Two']=a['Two'].astype('int') sns.pairplot(a) plt.show() ```

The problem comes from the fact that `pairplot` only accepts some pandas types in the `PairGrid`: float or int, but not `Object` or `Int64` for exemple (at least for some versions of matplotlib and/or seaborn: 3.0.3 and 0.9.0 respectivly generates that error).

Using `.astype('float')` before plotting in the following exemple should solve the problem as `a.One` is set to `Int64` and `a.Two` is initially an `Object` type:

``` a = pd.DataFrame() a['One'] = [1, 3, 3, 2, 1] a['One']=a['One'].astype('Int64') a['Two'] = ['yes', 'yes', 'no', 'yes', 'no'] a['Two'] = np.where(a['Two'] == 'yes', 1, a['Two']) a['Two'] = np.where(a['Two'] == 'no', 0, a['Two']) a['One']=a['One'].astype('int') a['Two']=a['Two'].astype('int') sns.pairplot(a) plt.show() ```

Remark that if you have `NaN` in the dataframe, `float` is your only option as `Int64` accepts missing values but not the `Int` type.

Using `.astype('float')` before plotting in the following exemple should solve the problem as `a.One` is set to `Int64` and `a.Two` is initially an `Object` type:

``` a = pd.DataFrame() a['One'] = [1, 3, 3, 2, 1] a['One']=a['One'].astype('Int64') a['Two'] = ['yes', 'yes', 'no', 'yes', 'no'] a['Two'] = np.where(a['Two'] == 'yes', 1, a['Two']) a['Two'] = np.where(a['Two'] == 'no', 0, a['Two']) a['One']=a['One'].astype('int') a['Two']=a['Two'].astype('int') sns.pairplot(a) plt.show() ```

The problem comes from the fact that `pairplot` only accepts some pandas types in the `PairGrid`: float or int, but not `Object` or `Int64` for exemple (at least for some versions of matplotlib and/or seaborn: 3.0.3 and 0.9.0 respectivly generates that error).

Using `.astype('float')` before plotting in the following exemple should solve the problem as `a.One` is set to `Int64` and `a.Two` is initially an `Object` type:

``` a = pd.DataFrame() a['One'] = [1, 3, 3, 2, 1] a['One']=a['One'].astype('Int64') a['Two'] = ['yes', 'yes', 'no', 'yes', 'no'] a['Two'] = np.where(a['Two'] == 'yes', 1, a['Two']) a['Two'] = np.where(a['Two'] == 'no', 0, a['Two']) a['One']=a['One'].astype('int') a['Two']=a['Two'].astype('int') sns.pairplot(a) plt.show() ```

Remark that if you have `NaN` in the dataframe, `float` is your only option as `Int64` accepts missing values but not the `Int` type.

Present in both answers;
Present only in the new answer;
Present only in the old answer;