Off topic:right way to working with dataframe and matplotlib
0
0
Entering edit mode
4.8 years ago
heuristic • 0

Hi !

I have a question about how I can work with pandas and matplotlib to make scatterplots.

I have a file space delimited like that:

    Flower1 Flower2 Flower3
Garden1 54  17  7   2
Garden2 28  49  13  4
Garden3 84  59  17  1
Garden4 17  3   29  0

In row 1 I have different flowers and in Column 1 I have different gardens, and I have values from Flower-Garden correspondence.

I try to make a scatterplot, using for example, the row 1 as x axis, and the column 1 as y axis, with the following script:

import matplotlib.pyplot as plt
import pandas as pd

df = pd.read_csv("flowers.txt",delim_whitespace=True)
ax = df.plot.scatter(x=df[1:0],y=df[0:1])

But an error occur: ValueError: Must pass DataFrame with boolean values only

Can anyone explain me how I can put those datas in the correct form?

thanks !

matplotlib dataframe graph python • 597 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1578 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6