Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Python 2.7 program
I am trying to run the following snippet of code. It is python 2.7 and it is in Windows 10 Professional'

import pandas as pd # data manipulation library
import numpy as np # numerical computation library
import datetime as dt

import matplotlib.pyplot as plt # plotting library
from matplotlib import cm # color maps for plotting'ggplot') # use the ggplot plotting style

%matplotlib inline #show plots in line in a jupyter notebook

from __future__ import division # division without truncating decimals

nfl = pd.read_csv('

But it is not interpreting.

I get the following error. It is in the comments and it makes no sense.

UsageError: unrecognized arguments: #show plots in line in a jupyter notebook
In this code at first it did not like the line that imports matplotlib.pyplot as plt.

I fixed it by uninstalling matplotlib and then reinstalling it.

Now it had the same issue with Pandas and Numpy. I uninstalled and reinstalled each module then
they worked.

Then this error occurred as shown above. I am confused. Each time I uninstalled and reinstalled the module
it worked,but a new issue popped up.

I know that should not be using python 2.7, but the code was originally Python 2.7.

I believe there is a program, actually a *.bat file that can take python 2 code and make it python 3.

It is not perfect, but anything is better than chasing your tail which is what I am doing now.

Can this piece of python 2.7 code be fixed? Should I use said program to upgrade the code to Python 3?

Any help appreciated.


%matplotlib inline #show plots in line in a jupyter notebook
Comments are not allowed on the line with one of these "magic" commands. That's why the error you're getting only shows the comment. Remove the comment or place it on a separate line.
(Oct-21-2020, 03:56 AM)ErnestTBass Wrote: I know that should not be using python 2.7, but the code was originally Python 2.7.
Python 2 is dead Angel
NumPy and Matplotlib do in newer version not support Python 2,only Python 3.
So pip install numpy will not work in Python 2.

Here demo in a Notebook,and code works fine.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Program running a lot slower after change to Ubuntu hubenhau 1 252 Mar-02-2021, 05:01 PM
Last Post: Serafim
  read terminal text from running program AArdvark_UK 2 421 Aug-27-2020, 12:43 PM
Last Post: AArdvark_UK
  Modify code from running program ? samuelbachorik 2 633 Jun-26-2020, 08:17 PM
Last Post: samuelbachorik
  Running the Regressive Imagery Dictionary program... treegreen 3 1,019 May-02-2019, 10:45 PM
Last Post: treegreen
  problem running program in VScode LavaCreeperKing 4 1,668 Mar-25-2018, 04:34 PM
Last Post: LavaCreeperKing
  Program not running (Overloading problem) anurag123 2 1,300 Feb-19-2018, 07:23 PM
Last Post: nilamo
  How to get the program's pid which is running with subprocess module? purecode 1 7,963 Jan-24-2018, 04:22 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020