zoukankan      html  css  js  c++  java
  • Ipython自动导入Numpy,pandas等模块

    一、引言

    最近在学习numpy,书上要求安装一个Ipythpn,可以自动导入Numpy,pandas等数据分析的模块,可是当我安装后,并不能自动导入numpy模块,还需要自己import。我就去查了一下ipython的官方文档。

    Introduction to IPython configuration(Ipython配置说明):http://ipython.org/ipython-doc/stable/config/intro.html

    二、创建配置文件

    1.打开命令行工具:如果省略配置文件名称,将为配置文件创建 default文件。这些文件位于~/.ipython/profile_default/,(~为Home目录,Windows就是自己的用户目录)并且被命名 ipython_config.py

    ipython profile create [profilename]
    

    2.到刚刚创建的配置文件 目录,编辑ipython_config.py。

    ## lines of code to run at IPython startup.
    #c.InteractiveShellApp.exec_lines = []

    将上面修改为:

    ## lines of code to run at IPython startup.
    c.InteractiveShellApp.exec_lines = ['import numpy as np']

    或者:from numpy import *   这样可以直接使用numpy里面的函数,比如arange(),而不需要np.arange()

    3.重新进入ipython,就可以自动导入Numpy并直接使用了。

  • 相关阅读:
    ioS开发之CoreLocation(GPS定位)
    iOSiOS开发之退出功能(易错)
    iOS开发之判断横竖屏切换
    iOS开发之左右抖动效果
    iOS开发之UIPopoverController
    thinkphp or查询
    Invalid left-hand side in assignment
    实现input表单从右向左输入
    thinkPhp不为空查询
    array_filter()用法
  • 原文地址:https://www.cnblogs.com/luhuan/p/7878962.html
Copyright © 2011-2022 走看看