1 pièce(s) jointe(s)
Supprimer les jours de week-end
Bonjour,
Je cherche à supprimer tous les jours de week-end.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
import pandas as pd
import datetime
import pandas_datareader.data as web
from pandas import Series, DataFrame
start = datetime.datetime(2009, 1, 1)
end = datetime.datetime(2020, 9, 16)
df = web.DataReader("EURUSD=X", 'yahoo', start, end)
df.tail()
close_px = df['Adj Close']
mavg = close_px.rolling(window=100).mean()
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib import style
# Adjusting the size of matplotlib
import matplotlib as mpl
mpl.rc('figure', figsize=(8, 7))
mpl.__version__
# Adjusting the style of matplotlib
style.use('ggplot')
close_px.plot(label='EURUSD=X')
mavg.plot(label='mavg')
plt.legend()
rets = close_px / close_px.shift(1) - 1
rets.plot(label='return')
dfcomp = web.DataReader(['EURUSD=X', 'GC=F', 'CL=F', '^FCHI'],'yahoo',start=start,end=end)['Adj Close']
dfcomp |
Merci de votre aide. Voici la photo de mon tableau de données. Pièce jointe 579421