pandasでcsv出力をしようとするとエラーになってしまう
pandasでcsv出力をしようとするとエラーになってしまいます。
csv_up.py
# -*- coding: utf-8 -*-
import pandas as pd
import csv
def make_csv_for_recipt(data_for_recipt):
df = pd.DataFrame([
["0001", "John", "Engineer"],
["0002", "ボブ", "Sales"]],
columns=['id', 'name', 'job'])
df.to_csv("employee.csv")
エラー内容は以下の通りです。
Traceback (most recent call last):
File "csv_up.py", line 2, in <module>
import pandas as pd
File "/root/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages/pandas/__init__.py", line 37, in <module>
import pandas.core.config_init
File "/root/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages/pandas/core/config_init.py", line 18, in <module>
from pandas.formats.format import detect_console_encoding
File "/root/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages/pandas/formats/format.py", line 33, in <module>
from pandas.io.common import _get_handle, UnicodeWriter, _expand_user
File "/root/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages/pandas/io/common.py", line 407, in <module>
def UnicodeReader(f, dialect=csv.excel, encoding="utf-8", **kwds):
AttributeError: module 'csv' has no attribute 'excel'
pythonのバージョン
# python -V
Python 3.6.0 :: Anaconda 4.3.1 (64-bit)