0

I have the following dataframe (2000 rows)

Latitude    Longitude
31.400091   -109.782830
31.400091   -108.782830
31.410091   -108.782830
31.405091   -109.782830
31.400091   -110.77830
31.460091   -12.782830
...            ...

I'm currently trying to represent it the point mass concentration with kde from seaborn package :

x = df['Longitude']
y = df['Latitude']

x = x.to_numpy()
y = y.to_numpy()

sns.kdeplot(x, y, zorder=0, n_levels=6, shade=True, 
    cbar=True, shade_lowest=False, cmap='viridis')

Which give me :

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [58], in <cell line: 1>()
----> 1 sns.kdeplot(x, y, zorder=0, n_levels=6, shade=True, 
      2     cbar=True, shade_lowest=False, cmap='viridis')

TypeError: kdeplot() takes from 0 to 1 positional arguments but 2 positional arguments (and 1 keyword-only argument) were given

I've tried with numpy array transformation and without it, same result.

My seaborn version : '0.12.0'

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
JEG
  • 154
  • 1
  • 15
  • 1
    `x = x.to_numpy()` and `y = y.to_numpy()` is not necessary. The correct way is `sns.kdeplot(data=df, x='Longitude', y='Latitude', zorder=0, n_levels=6, shade=True, cbar=True, shade_lowest=False, cmap='viridis')` – Trenton McKinney Oct 25 '22 at 15:14

1 Answers1

3

Try this:

sns.kdeplot(x=x, y=y, zorder=0, n_levels=6, shade=True, 
    cbar=True, shade_lowest=False, cmap='viridis')