ipython notebook에서 pandas 사용할 때 다음 에러가 발생했다.


numpy.dtype has the wrong size, try recompiling

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in <module>

    from . import hashtable, tslib, lib

  File "numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:22331)

ValueError: numpy.dtype has the wrong size, try recompiling




버전은 최신이라서 문제가 없는 것 같았다.


$ pip show pandas

---

Name: pandas

Version: 0.16.2

Location: /Library/Python/2.7/site-packages

Requires: numpy, python-dateutil, pytz

$ pip show numpy

---

Name: numpy

Version: 1.9.2

Location: /Library/Python/2.7/site-packages/numpy-1.9.2-py2.7-macosx-10.9-intel.egg

Requires:


pip uninstall 해도 진전이 없다가 다음 싸이트에서 보고, 따라하니(easy_install 설치) pandas를 잘 사용할 수 있었다.


https://github.com/pydata/pandas/issues/7517

@phani-vadrevu Following your instructions, I can import pandas finally.
1. updated numpy to 1.9.0 using "sudo easy_install -U numpy" (while "sudo pip install -U numpy" did nothing but keep the old version)
2. checked whether numpy was updated to the latest version
3. updated pandas to the latest version using easy_install
4. checked whether importing pandas works.
5. done.








Posted by '김용환'
,


ipython notebook (http://ipython.org/notebook.html) 설치하려면,


설치 문서(http://ipython.org/install.html)처럼 하지 말고. 아래와 같이 하면 된다. 

(http://ipython.org/ipython-doc/2/install/install.html)


$ sudo pip install "ipython[all]"




그 다음, 예제를 테스트하기 위해서 아래 소스를 다운 받는다.


https://github.com/ipython/ipython




그리고, 소스 받은 디렉토리에서 다음 커맨드를 실행한다.

$ ipython notebook



예제를 찾아 실행한다.





* lib 설치

numpy, scipy,matplotlib은 같이 설치된다.

그러나 pandas는 같이 설치 안되서 같이 설치한다.


$ pip install pandas 


Posted by '김용환'
,

 

 

#!/usr/bin/python

fname = "a.txt”
nfname = "b.txt"

f = open(fname)  
for line1 in f:     
    print 'line : %s ' %line1
    nnif = open(nfname)
    for line2 in nnif:
        if line1 in line2 : 
            print 'found string in file %s' %line2
            break

Posted by '김용환'
,

[Go Language] 링크 모음

python 2010. 6. 10. 21:20
 
Erlang 언어를 보면서 참 재미없다고 생각했다.. 당시 얼마나 나는 java api에 길들여져 있었을까..
그리고, java, c 외엔 관심도 없었는데..

내가 사용해본 언어를 보면.. 그리 많지 않다.

java > perl > javascript > c > c++ , sh(csh, bash) > python >> cobol 정도..

개인적으로 go 언어를 볼까 싶다... language에 대한 깊이를 슬슬 올려야지~

홈페이지
http://golang.org/

tutorial 
http://golang.org/doc/go_tutorial.html

Go와 Brand X 비교
http://www.cowlark.com/2009-11-15-go/

한국 분이 간단히 발표한 자료
http://rein.kr/blog/archives/2288
Posted by '김용환'
,

 

 

Python development with Eclipse and Ant

http://www-128.ibm.com/developerworks/opensource/library/os-ecant/

 

RPS Technologies - Python Ant tasks

http://www.rpstechnologies.net/PyAntTasks.html

 

------------------------------------------------------------------

 

 

Python development using the Eclipse IDE and Apache Ant build tool

 

Using Eclipse for Python development

Overview of Eclipse

Eclipse is a Java technology integrated development environment that was developed and open sourced by IBM. It is the basis for IBM's commercial WebSphere Application Development environment, and various other tools. Eclipse has an extremely active community of developers who develop Eclipse itself and the large number of plug-ins available for it. See the Resources section for links to the Eclipse and Eclipse plug-ins Web sites. Although traditionally a tool for Java development, several plug-ins exist for developing with other languages within Eclipse, including C/C++, Python, and Perl.

Within Eclipse, source code is organized into projects. Projects may be loaded, unloaded, and imported. The Eclipse user interface is structured into views and editors. Examples of views and editors include the source code outline view, Java source editor, Python source editor, and filesystem navigator view. One of the key metaphors within the Eclipse user interface is the perspective. Perspectives are an organization of views that would typically be used together when carrying out some type of activity. The perspectives that are standard with Eclipse are: Debug, Java Browsing, Java, Java Type Hierarchy, Plug-in Development, CVS Repository Exploring, Resource, and the Install/Update perspective. A separate Python perspective does not currently exist. When doing Python development, I typically use the Resource perspective and Debug perspective.

Installing PyDev

To get started, download and install Eclipse from the Eclipse Web site (see link in Resources section), following the installation instructions appropriate for your platform.

The Eclipse update facility makes it easy to install the PyDev plug-in. From within Eclipse, select Help > Software Updates > Update Manager to start the Install/Update perspective. In the Feature Updates view at the bottom left, add the PyDev plug-in update site as a new Site Bookmark under the folder "Sites to Visit". The Eclipse update site URL for PyDev is http://pydev.sf.net/updates/. "PyDev" should now be displayed as a feature in the Feature Updates editor. In the Feature Updates editor, expand PyDev > Other, and select the PyDev feature which is displayed (should be at least 0.4.1). Then select "Install Now" to install the feature. Eclipse will download the PyDev plug-in and install it into Eclipse.

Importing the sample project

To access the sample code used within this project, download the zip file (see Resources section), expand the zip file into your filesystem, and then import the contained project into Eclipse. To import the project, switch into the Resource perspective, select File > Import, select "Existing Project into Workspace", and select the location where you expanded the zip file. The feedParserTest project should now appear in the Navigator view.

For the sample project, I've included the Feed Parser universal feed parser library, which is distributed under the Python open source license. See the Resources section for a link to the Feed Parser project Web site.

Posted by '김용환'
,