Economy: Nokiaについて, python, pandas, quandl ver. 2

ファインランド経済とNokiaについて調べています。

 

I.概要

 

Nokia: Life after the fall of a mobile phone giant

 

II.Nokiaの株価の推移

 

Nokia – 25 Year Stock Price History | NOK

 

pythonでグラフにしました。pd.to_datetime()でtime seriesとすると年月での選択やx軸のメモリを簡単に調整でます。

 

 

 

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

# skip 2 rows from top in csv and initialize a dataframe
nokia0 = pd.read_csv('/MacroTrends_Data_Download_NOK.csv', skiprows=10)

# convert nokia0['date'] from string to datetime
nokia0['date'] = pd.to_datetime(nokia0['date'])

# set df['date'] as the index
ts = nokia0.set_index('date')

# show the plot for all the years
plt.plot(ts.index, ts['close'])
plt.xticks(rotation='vertical')

# subset 2019
ts2019 = ts['2019']
ts2019.head()

# show the plot for 2019
plt.plot(ts2019.index, ts2019['close'])
plt.xticks(rotation='vertical')

 

III.人口

 

経済金融データ提供サイトのquandlのAPIを利用して人口のグラフを描きます。APIキーを取得する必要があります。制限はありますが、無料で利用できます。

 

 

# import libraries
import quandl
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# Your API key
quandl.ApiConfig.api_key = 'YOURAPIKEY'
# get the data
finland_pop = quandl.get('ODA/FIN_LP')
# show the plot for all the years
plt.plot(finland_pop.index, finland_pop['Value'])
plt.xticks(rotation='vertical')

 

Please follow and like us:
error

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.