Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
127 views
in Technique[技术] by (71.8m points)

python - how to install numpy and pandas on windows

I'll preface by saying I'm a programming n00b by stack standards. I have experience with data analysis and scripting -- this is what I do professionally at a financial firm -- but I have no idea what I'm doing on the back end.

I'm trying to start using pandas and python --- moving away from matlab/vba but I can't figure out how to install the pandas library.

When I try to import pandas I get an error that numpy module is not present. I tried to install ezsetup / pip (no idea what this is btw)... and I have no idea where to enter this command$ python get-pip.py

Sometimes when I try to import pandas I get an error cannot import name table hashable

I have no idea what any of this means and I am not getting anywhere.

Update

Ok I installed anaconda and it seems to be allowing me to import numpy and pandas directly from the console. That being said when I try to write a basic time series and plot it using pandas syntax, i get an error that "series is not defined" as such I'm not sure if it is actually working

  In [1]: import matplotlib.pyplot as plt
  In [2]: ts = Series(randn(1000), index=date_range('1/1/2000', periods=1000))
  In [3]: ts = ts.cumsum()
  In [4]: ts.plot()
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The best resource for third-party modules for Windows is Christoph Gohlke's Python Extension Packages for Windows repository. Each module is available as a self-extracting .exe installer, for use with the python.org version of Python - make sure you get the correct installer for your version and architecture.

While NumPy does not require any other packages, pandas does, so make sure you get them all. The installation order is not important.

The advantages of this resource over a distribution like Anaconda or Enthought is that Dr. Gohlke keeps the packages very up to date, allowing you to run the latest versions of the modules. Additionally, nearly all of the modules have multiple Python versions, while some of the other distributions are only based on Python 2.7.

The disadvantage is that you need to install each package individually, and there is no package manager for handling dependencies.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...