Reputation: 51
My python version is: Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32
I'm getting a message called "Syntax Error| There's an error in your program: invalid syntax"
The 7 in Python 2.7 is highlighted red.
My code is:
Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
import numpy as np
def graphRawFX () :
date,bid,ask = np.loadtxt('GPBUSD1d.txt'), unpack=True,
delimiter=',',
converters={0:mdates.strpdate2num('%Y%m%d%H%M%S') }
fig = plt.figure(figsize=(10,7))
ax1 = plt.subplot2grid((40,40), (0,0), rowspan=40, colspan=40)
ax1.plot(date,bid)
ax1.plot(date,ask)
ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
Upvotes: 2
Views: 2908
Reputation: 532418
The first two lines are not Python code; they are just introductory text when you start the interpreter. Remove them from the script, as it appears you copy-and-pasted too much from an example. Once you've done that, you'll also need to fix your indentation, as at least one of the lines following the def graphRawFX()
line needs to be indented.
Upvotes: 2