Error: Line magic function

2019-04-06 14:47发布

I'm trying to read a file using python and I keep getting this error

ERROR: Line magic function `%user_vars` not found.

My code is very basic just

names = read_csv('Combined data.csv')
names.head()

I get this for anytime I try to read or open a file. I tried using this thread for help.

ERROR: Line magic function `%matplotlib` not found

I'm using enthought canopy and I have IPython version 2.4.1. I made sure to update using the IPython installation page for help. I'm not sure what's wrong because it should be very simple to open/read files. I even get this error for opening text files.

EDIT:

I imported traceback and used

 print(traceback.format_exc())

But all I get is none printed. I'm not sure what that means.

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-04-06 15:12

Looks like you are using Pandas. Try the following (assuming your csv file is in the same path as the your script lib) and insert it one line at a time if you are using the IPython Shell:

import pandas as pd 
names = pd.read_csv('Combined data.csv')
names.head()
查看更多
登录 后发表回答