Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Columns of all None treated differently than all np.nan #23

Open
alistairewj opened this issue May 3, 2018 · 0 comments
Open

Columns of all None treated differently than all np.nan #23

alistairewj opened this issue May 3, 2018 · 0 comments

Comments

@alistairewj
Copy link

Maybe a bit niche, but ran into this issue with lineplot: if there is a column of all np.nan, then it is ignored, but if there is a column of all None, then it makes the plot really wacky.

Generate some data:

import pandas as pd
import numpy as np
import pdvega
%matplotlib inline

# generate some data
np.random.seed(111)
df = pd.DataFrame(np.random.randn(50, 4), 
        index=pd.date_range('1/1/2000', periods=50),
                  columns=list('ABCD'))
df = df.cumsum()
# this plot is fine
df.vgplot()

image

# this column is ignored in the plot
df['nan'] = np.nan
df.vgplot()

(looks the same as above)

# this column makes everything weird
df['none'] = None
df.vgplot()

image

Oddly enough this doesn't happen if the A and B columns are int:

np.random.seed(111)
df = pd.DataFrame(np.random.randint(low=0, high=5, size=[50, 2]), 
        index=pd.date_range('1/1/2000', periods=50),
                  columns=list('AB'))
df = df.cumsum()

# add a column of all none
df['nan'] = np.nan

# add a column of all none
df['none'] = None
df.vgplot()

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant