Skip to content

Commit 6af368a

Browse files
fix date issues with test_original_flavor; increase image diff tolerance
1 parent c89b4b9 commit 6af368a

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

examples/original_flavor/date_demo1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
from pandas.plotting import register_matplotlib_converters
1919
register_matplotlib_converters()
2020
from matplotlib.dates import DateFormatter, MonthLocator, YearLocator
21+
import os.path
2122

2223
years = YearLocator() # every year
2324
months = MonthLocator() # every month
2425
yearsFmt = DateFormatter('%Y')
2526

26-
quotes = pd.read_csv('data/yahoofinance-INTC-19950101-20040412.csv',
27-
index_col=0,
28-
parse_dates=True,
29-
infer_datetime_format=True)
27+
# make file paths OS independent
28+
infile = os.path.join('data','yahoofinance-INTC-19950101-20040412.csv')
29+
quotes = pd.read_csv(infile,index_col=0,parse_dates=True,infer_datetime_format=True)
3030

3131
dates = quotes.index
3232
opens = quotes['Open']

examples/original_flavor/date_demo2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
register_matplotlib_converters()
1111
from matplotlib.dates import (MONDAY, DateFormatter, MonthLocator,
1212
WeekdayLocator)
13+
import os.path
1314

1415
date1 = "2002-1-5"
1516
date2 = "2003-12-1"
@@ -22,7 +23,8 @@
2223
monthsFmt = DateFormatter("%b '%y")
2324

2425

25-
quotes = pd.read_csv('data/yahoofinance-INTC-19950101-20040412.csv',
26+
infile = os.path.join('data','yahoofinance-INTC-19950101-20040412.csv')
27+
quotes = pd.read_csv(infile,
2628
index_col=0,
2729
parse_dates=True,
2830
infer_datetime_format=True)

examples/original_flavor/finance_demo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pandas.plotting import register_matplotlib_converters
77
register_matplotlib_converters()
88
from matplotlib.dates import MONDAY, DateFormatter, DayLocator, WeekdayLocator
9+
import os.path
910

1011
from mplfinance.original_flavor import candlestick_ohlc
1112

@@ -18,7 +19,8 @@
1819
weekFormatter = DateFormatter('%b %d') # e.g., Jan 12
1920
dayFormatter = DateFormatter('%d') # e.g., 12
2021

21-
quotes = pd.read_csv('data/yahoofinance-INTC-19950101-20040412.csv',
22+
infile = os.path.join('data','yahoofinance-INTC-19950101-20040412.csv')
23+
quotes = pd.read_csv(infile,
2224
index_col=0,
2325
parse_dates=True,
2426
infer_datetime_format=True)

examples/original_flavor/finance_work2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import pandas as pd
77
from pandas.plotting import register_matplotlib_converters
88
register_matplotlib_converters()
9+
import os.path
910

1011
ticker = 'SPY'
11-
r = pd.read_csv('data/yahoofinance-SPY-20080101-20180101.csv',
12+
infile = os.path.join('data','yahoofinance-SPY-20080101-20180101.csv')
13+
r = pd.read_csv(infile,
1214
index_col=0,
1315
parse_dates=True,
1416
infer_datetime_format=True)

examples/original_flavor/longshort.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@
1010
from pandas.plotting import register_matplotlib_converters
1111
register_matplotlib_converters()
1212

13+
import os.path
1314
from six.moves import urllib
1415

1516
start_date = "2004-8-19"
1617
end_date = '2018-1-20'
1718

1819
# grab the price data off yahoo csv quotes
19-
r1 = pd.read_csv('data/yahoofinance-AAPL-20040819-20180120.csv',
20+
21+
infile1 = os.path.join('data','yahoofinance-AAPL-20040819-20180120.csv')
22+
r1 = pd.read_csv(infile1,
2023
index_col=0,
2124
parse_dates=True,
2225
infer_datetime_format=True)
23-
r2 = pd.read_csv('data/yahoofinance-GOOG-20040819-20180120.csv',
26+
27+
infile2 = os.path.join('data','yahoofinance-GOOG-20040819-20180120.csv')
28+
r2 = pd.read_csv(infile2,
2429
index_col=0,
2530
parse_dates=True,
2631
infer_datetime_format=True)

examples/original_flavor/plot_day_summary_oclh_demo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
register_matplotlib_converters()
88
from matplotlib.dates import (MONDAY, DateFormatter, MonthLocator,
99
WeekdayLocator, date2num)
10+
import os.path
1011

1112
from mplfinance.original_flavor import plot_day_summary_oclh
1213

@@ -18,7 +19,8 @@
1819
daysFmt = DateFormatter("%d %b %y")
1920

2021

21-
quotes = pd.read_csv('data/yahoofinance-INTC-19950101-20040412.csv',
22+
infile = os.path.join('data','yahoofinance-INTC-19950101-20040412.csv')
23+
quotes = pd.read_csv(infile,
2224
index_col=0,
2325
parse_dates=True,
2426
infer_datetime_format=True)

tests/test_addplot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
except:
2222
print('Error removing file "'+fn+'"')
2323

24-
IMGCOMP_TOLERANCE = 7.0
24+
# IMGCOMP_TOLERANCE = 7.0 # this works fine for linux
25+
IMGCOMP_TOLERANCE = 11.0 # required for a windows pass. (really 10.25 may do it).
2526

2627
def test_addplot01(bolldata):
2728

0 commit comments

Comments
 (0)