1

(My first ever StackOverflow question)

I'm trying to plot bitcoin's market-cap against the date using pandas and matplotlib in Python.

Here is my code:

%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

#read in CSV file using Pandas built in method
df = pd.read_csv("btc.csv", index_col=0, parse_dates=True)

Here are some details about the data frame: dataframe details

matplotlib code:

#Plot marketcap(usd)
plt.plot(df.index, df["marketcap(USD)"])
plt.show()

Result: Incorrect result

The plot seems to be more like scribbles that seem to move backwards. How could I fix this?

AjithA
  • 11
  • 1

1 Answers1

1

You can plot your Pandas Series "marketcap(USD)" directly using:

df["marketcap(USD)"].plot()

See the Pandas documentation on Basic Plotting

PythonSherpa
  • 2,560
  • 3
  • 19
  • 40