Trying to parse text files in python for data analysis

后端 未结 3 1231
执念已碎
执念已碎 2021-01-21 13:38

I do a lot of data analysis in perl and I am trying to replicate this work in python using pandas, numpy, matplotlib, etc.

The general workflow goes as follows:

3条回答
  •  鱼传尺愫
    2021-01-21 14:18

    You are getting the following:

    NameError: name 'MultiIndex' is not defined
    

    because you are not importing MultiIndex directly when you import Series and DataFrame.

    You have -

    from pandas import Series, DataFrame
    

    You need -

    from pandas import Series, DataFrame, MultiIndex
    

    or you can instead refer to MultiIndex using pd.MultiIndex since you are importing pandas as pd

提交回复
热议问题