Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8308489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:49:46+00:00 2026-06-08T18:49:46+00:00

I have got some problems with plotting a sliced DataFrame with entire columns filled

  • 0

I have got some problems with plotting a sliced DataFrame with entire columns filled with NaN’s.

How come:

pandas.DataFrame(
    dict(
        A=pandas.Series([np.NaN]*32),
        B=pd.Series(range(-1,32))
    )
).plot()

differs from:

#Ugly fix
pandas.DataFrame(
    dict(
        A=pandas.Series( [0] + [numpy.NaN]*32),
        B=pd.Series(range(-1,32))
    )
).plot()

by plotting a 0-line as if the column is filled with zeros.
Shouldn’t the first code work just as:

pylab.plot(
    range(0,33),
    range(-1,32),
    range(0,32),
    [numpy.NaN]*32
)

And also plotting just a Series filled with NaN works fine:

pandas.Series([numpy.NaN]*32).plot()

What am I missing? Is there a right way to plot a column with all NaN’s or is it a bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:49:47+00:00Added an answer on June 8, 2026 at 6:49 pm

    This looks like a bug in pandas. Looking at the source code, in pandas.tools.plotting, lines 554:556:

    empty = df[col].count() == 0                                       
    # is this right?                                                   
    values = df[col].values if not empty else np.zeros(len(df))        
    

    If the column contains only NaNs, then empty is True and values is set to np.zeros().

    Note: I did not add the “is this right?” comment: it’s in the source code! (pandas v.0.8.1).

    I’ve raised a bug about it: https://github.com/pydata/pandas/issues/1696

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner in Java and I have got some problems with the static
I got some problems in Datagrid WPF I have a datagrid, and I want
I'm having some problems building an hierarchistic array structure - I have almost got
i've got some problems using jQTouch. I have this Link <a href=#site_map class=swap>Map</a> and
I am learning to use mysql.So, I got some problems. I have three table
I have some problems with ajax responses. Everything is working okay, however I got
Working on implementation of paypal's recurring payments, I've got encountered some problems. I have
I am having some Problems with JavaScript. I have got the following code: <html>
I'm getting crazy with this problem: I have got some Oracle SQL-Reports to redesign
I have some problem with Jquery Autocomplete plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ ) I got it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.