# A simple data analysis of Bitcoin provided by CoinMetrics in Python

## 【Text】

This time, I will change my mind a little and introduce an example of simple data analysis (visualization) using Python. CoinMetrics provides data of each cryptocurrency (including stable coins) in csv format, so I used that to visualize the transaction volume and price (USD) of Bitcoin.

Since Python has abundant libraries for data analysis, it is nice to have only a few lines to dozens of lines for simple visualization. (In this case, it is possible to visualize somehow with a very simple code just by using pandas and matplotlib. When trying to realize the same thing with MS-Excel ...)

** ** The data provided by CoinMetrics can be downloaded from the following (Data from major cryptocurrencies can be used) https://coinmetrics.io/community-network-data/

## [Python code]

#### getCoinMetrics

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

data['date'] = pd.to_datetime(data['date'])
data.set_index('date', inplace=True)
• Now you can analyze the data based on the date.

** **

plt.plot(data.TxCnt)

** <Visualize price (USD) transitions by year> **

plt.plot(data.PriceUSD)

** <Representing the annual transition status of transaction volume and price (USD) in a composite graph> **

fig, ax1 = plt.subplots()
plt.plot(data.TxCnt, color='darkblue', label='TxCnt')

ax2 = ax1.twinx()
plt.plot(data.PriceUSD, color='darkorange', label='PriceUSD')

h1, l1 = ax1.get_legend_handles_labels()
h2, l2 = ax2.get_legend_handles_labels()
ax1.legend(h1+h2, l1+l2, loc='upper left')

ax1.set_xlabel('date')
ax1.set_ylabel('TxCnt')
ax2.set_ylabel('PriceUSD')

** <By the way, it is possible to narrow down to a specific year (example: 2014)> **

#### Excerpt only for changes

~
plt.plot(df_data['2014'].TxCnt, color='darkblue', label='TxCnt')
~
plt.plot(df_data['2014'].PriceUSD, color='darkorange', label='PriceUSD')
~

• It is interesting to see a negative correlation between transaction volume and price (USD). After this, the transaction volume continues to increase.

** **

plt.scatter(data.TxCnt,data.PriceUSD)

• When the number of transactions reaches a certain amount (200,000-), the price impact is less noticeable. (I can say that)

that's all