サブモジュールは暗黙的にインポートされず、明示的に宣言する必要がありますが、サブモジュールを明示的に呼び出していますよね?pd.Series
とにかく、の呼び出しをimport pandas as pd
許可しpd.Series
てはいけませんか? 次のコードはiPythonでは問題なく動作しますが、スクリプトから実行すると失敗します。
#!/usr/bin/env/python2.7
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
counts = pd.Series([632, 1638, 569, 115], index=["Firmicutes", "Proteobacteria", "Actinobacteria", "Bacteroidetes"])
結果:
tyler@machine ~/src/stats $ python pandas.py
Traceback (most recent call last):
File "pandas.py", line 3, in <module>
import pandas as pd
File "/home/tyler/src/stats/pandas.py", line 6, in <module>
counts = pd.Series([632, 1638, 569, 115], index=["Firmicutes", "Proteobacteria", "Actinobacteria", "Bacteroidetes"])
AttributeError: 'module' object has no attribute 'Series'
どこで間違ったのですか?