Python Data Analysis Essentials Anaconda installation, shortcut keys, package installation

Source: Internet
Author: User

Python Data Analysis Prerequisites:

1.Anaconda operation

First, you should set the local data directory as the working directory, so that you can load the local data set into memory

Import Osos.chdir ("d:/bigdata/workspace/testdata/"# Sets the current path to the working path OS.GETCWD ()   # Gets the current working path
2. Installing Graphviz

Excerpt from official website:

What is Graphviz?

Graphviz is open source graph visualization software. Graph Visualization is a-representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and Web design, machine Learni Ng, and in visual interfaces for other technical domains.

What is Graphviz?

Graphviz is an open source graphical visualization software. Graphical visualization is the representation of structural information as abstract graphs and network diagrams. It has important applications in the visual interface of networks, bioinformatics, software engineering, database and Web design, machine learning and other technical fields.

Url:

http://www.graphviz.org/     or   http://www.graphviz.org/Download..php   #安装

Command: Dot-tpdf iris.dot-o output.pdf to convert a dot file into a PDF file that has been converted to graphics

3.Anaconda shortcut Keys

Open Ipython Notebook mode:

3.1 Enter in cmd ~

3.2 Default browser will open Http://localhost:8888/tree

3.3 Run the current line and wrap the line Shift+enter

Run Current line: Ctrl+enter

3.4 Conda Version View

Conda Install all the packages

See a few Python environments

4. Create a multi-environment anaconda

4.1 Use the Conda create command, followed by any name you wish to call it:

create --name snowflake biopython

This command will create a new environment for the Biopython package, located in the/envs/snowflakes
Tip: A lot of the following-used command options, can be abbreviated as a short-term plus command initials. So the--name option is the same as the-n function. See a large number of abbreviations by conda-h or conda–-help.

4.2 Activating this new environment

Linux,OS X::  activate snowflakesWindows::      activate snowflake`

Tip: The new development environment will be installed by default in the Envs file directory under your Conda directory.

4.3 Creating a second environment

This time let's create and name a new environment, then install another version of Python and two packages astroid and Babel.

conda create -n bunnies python=3 Astroid Babel

This creates a second based Python3, which contains astroid and Babel packages, called Bunnies, in a new environment, in the/envs/bunnies folder.
Tip: Install the package you want to run in this environment at the same time,
Tip: Install all the packages you want at the same time you create the environment, and then install them in turn may cause dependency problems

4.4 List all environments

4.6 Copying an environment

Clones to replicate an environment. Here you will create a copy of the snowfllakes called Flowers by cloning the.

conda create -n flowers --clone snowflakes

Check the environment with Conda Info–-envs
You should now be able to see a list of environments: flowers, bunnies, and snowflakes.

4.7 Deleting an environment

If you do not want the environment named flowers, remove the environment as follows:

remove -n flowers --all

In order to determine that the environment named Flowers has been removed, enter the following command:

conda info -e

Flowers is no longer in your environment list, so we know it has been deleted.

4.8 Check Python version

First let's check that version of Python can be installed:

conda search --full --name python

You can use Conda search Python to see all packages with "Python" in their names, or add --full --name command options to list packages that match exactly "Python".

4.9 Confirm that the environment was added successfully

To ensure that the snakes environment is already installed, type the following command:

conda info -e

Conda will display the list of environments, and the currently active environment will be enclosed in parentheses.(snakes)

4.10 Using different versions of Python

In order to use different versions of Python, you can switch the environment by simply activating it to see how to return to the default 2.7

activate snowflakes·Windows:activate snowflakes
4.11
Unregister the Environment

When you have completed the studio in the snowflakes environment, log out of the environment and convert your path to the previous state:

deactivate·Windows:deactivate

4.12 Find a Package

First let's check whether the package we need can be installed through Conda:

search beautifulsoup4

It shows this package, so we know it is available.

installation package in 5.Anaconda

5.1 Installing a package from anaconda.org

If a package cannot be installed using Conda, we will then look for it on the anaconda.org website. Anaconda.org provides package management services to public and private package warehouses. Anaconda.org is a continuous analysis product.

Tip: You don't need to register when you download something in anaconda.org.
In order to download from anaconda.org to the current environment, we need to specify anaconda.org as a specific channel by entering the full path of the package.
In the browser, go to the http://anaconda.org website. We look for a package called "bottleneck", so enter "bottleneck" in the top left-hand corner called "Search Anaconda Cloud" and click the Search button.
There will be more than a dozen bottleneck packages available on the anaconda.org, but we want the version that is most frequently downloaded. So you can sort by download volume by clicking on the download bar.
Click the package name to select the most frequently downloaded package. It will link to the anaconda.org details page to display the specific commands for the download:

install --channel https://conda .anaconda.ort/pandas bottleneck

5.2 To install a package by using the PIP command

For packages that cannot be installed through Conda or obtained from anaconda.org, we can usually install packages with PIP ("Pip install packages" abbreviation).
Tip: Pip is just a package manager, so it can't manage your environment for you. PIP cannot even upgrade Python because it does not treat Python as a package like Conda. But it can install some packages that Conda cannot install, and vice versa (not translated here). Both Pip and Conda are integrated in the Anaconda or Miniconda.

We activate the environment where we want to place the program, and then install a program called "See" via PIP.

bunnies·Windows:activate bunnies所有平台:pip install see

5.3Check PIP installation

Check if See is installed:

conda list

5.4 Installing the Commercial package

Installing the business package is an exception to the process of installing other packages. For example, let's install and remove a free trial Iopro of an updated business pack that can speed up your python processing:

conda install iopro

5.5 Removing packages, environments, or Conda

If you like. Let's end this test guide by removing one or more test packages, environments, and Conda.

5.6 Removing packages

Suppose you decide not to use the business package Iopro. You can remove it from the Bunnies environment.

conda remove -n bunnies iopro

5.7 Confirm that the package has been removed

Use the Conda List command to confirm that Iopro has been removed

conda list

5.8 Removing the environment

We no longer need to snakes the environment, so enter the following command:
Conda remove-n Snakes--all

5.9 Confirm that the environment is removed

In order to confirm that the snakes environment has been removed, enter the following command:

conda info --envis

Snakes is no longer displayed in the environment list, so we know it has been deleted.

5.10 Delete Conda

    • Linux,os X:
      Remove the Anaconda or Miniconda installation folder
rm -rf ~/miniconda OR  rm -rf ~/anaconda


<end>

Python Data Analysis Essentials Anaconda installation, shortcut keys, package installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.