question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dcgan.py: `df.plot(x=np.array([1, 101, 201]))` doesn't work

See original GitHub issue

Line https://github.com/pytorch/ignite/blob/master/examples/gan/dcgan.py#L393 fails with an error,saying that nothing in Int64Index([1, 101, 201]) is in df.columns (or something like that). To fix it, set index of the dataframe instead of passing x argument.

Replace this:

df = pd.read_csv(os.path.join(output_dir, LOGS_FNAME), delimiter='\t')
x = np.arange(1, engine.state.iteration + 1, PRINT_FREQ)
_ = df.plot(x=x, subplots=True, figsize=(20, 20))

with this

df = pd.read_csv(os.path.join(output_dir, LOGS_FNAME), delimiter='\t') \
    .set_index(np.arange(1, engine.state.iteration + 1, PRINT_FREQ))
_ = df.plot(subplots=True, figsize=(20, 20))

My python version is 3.7, pandas is 0.24.2.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
philip-blcommented, May 1, 2019

@vfdev-5 Not really. Overhead of doing git clone, setting up remote repositories, applying patch there, pushing, creating a PR - it’s too much.

1reaction
philip-blcommented, May 1, 2019

@vfdev-5 Yes, that sounds better. Just to be clear, I don’t want to do be the person responsible for implementing that change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.DataFrame.plot showing colormap inconsistently
It actually seems to be related to pandas (scatter) plot and as you've pointed out to dtype float - some more details at...
Read more >
Chart visualization — pandas 1.5.2 documentation - PyData |
Basic plotting: plot #. We will demonstrate the basics, see the cookbook for some advanced strategies. The plot method on Series and DataFrame...
Read more >
Shaping and reshaping NumPy and pandas objects to avoid ...
Let's make a NumPy array from our DataFrame and check its shape. The shape returned matches what we saw when we used pandas....
Read more >
Plot With Pandas: Python Data Visualization for Beginners
plot () returns a line graph containing data from every row in the DataFrame. The x-axis values represent the rank of each institution,...
Read more >
How to Fix: Length of values does not match length of index
This tutorial explains how to fix the following error in Python: ... assign a NumPy array of values to a new column in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found