Python data Analytics-2nd Chapter-ptyhon World Profile

Source: Internet
Author: User
Tags sin enthought canopy

2nd Python World Introduction 12
2.1 python--programming Language 12
2.2 python--Interpreter 13
2.2.1 Cython 14
2.2.2 Jython 14
2.2.3 PyPy 14
2.3 Python 2 and Python 3 14
2.4 Installing Python 15
2.5 Python Release 15
2.5.1 Anaconda 15
2.5.2 Enthought Canopy 16
2.5.3 Python (x, y) 17
2.6 Using Python 17
2.6.1 Python Shell 17
2.6.2 running the full Python program 17
2.6.3 writing code with the IDE 18
2.6.4 interacting with Python 18
2.7 Writing Python code 18
2.7.1 Mathematical Operations 18

 1 
2
3
4
5
6
7
8
9
10
11
12
13
>>> 1 + 2
3
>>> (1.045 * 3)/4
0.78375
>>> 4 * * 2
16
>>> ((4 + 5j) * (2 + 3j))
( -7+22J)
>>> 4 < (2*3)
True
>>> A = 12 * 3.4
>>> A
40.8

2.7.2 importing new libraries and functions 19

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
>>> Import Math
>>> Math.sin (a)
>>> from Math Import *
>>> sin (a)
>>> from math import sin

>>> dict = {' name ': ' William ', ' age ': +, ' city ': ' London '}
>>> dict["Name"]
' William '
>>> for key, value in Dict.items ():
...
name William
city London
age

>>> list = [1,2,3,4]
>>> list
[1, 2, 3, 4]

>>> list[2]
3
>>> List[1:3]
[2, 3]
>>> List[-1]
4

>>> items = [ 1,2,3,4,5]
>>> for item ' in items:
... Item + 1

2.7.3 Functional Programming 21

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
>>> items = [1,2,3,4,5]
>>> def Inc (X): Return x+1
...
>>> list (map (inc,items))
[2, 3, 4, 5, 6]

>>> list (map (lambda x:x+1, items))
[2, 3, 4, 5, 6]

The filter function only extracts a list element with a function that returns a result of true.
The reduce function returns a unique result after all elements in the list are evaluated sequentially.
>>> List (filter ((Lambda x:x < 4), items)
[1, 2, 3]
>>> from functools Import reduce
>>> Reduce ((lambda x,y:x/y), items)
0.008333333333333333

>>> S = [x**2 for x in range (5)]
>>> S
[0, 1, 4, 9, 16]

2.7.4 Indent 22

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
>>> A = 4
>>> If a > 3:
... if a < 5:
... print ("I ' M Four")
.. else:
... print ("I ' m a little number")
...
I ' M four
>>> If a > 3:
... if a < 5:
... print ("I ' M Four")
.. else:
... print ("I ' m a big number")
...
I ' M four

2.8 IPython 23
2.8.1 IPython Shell 23
2.8.2 IPython Qt-console 24
2.9 PyPI Warehouse--python Package Index 25
2.1 + Python IDE 26
2.10.1 IDLE 26
2.10.2 Spyder 27
2.10.3 Eclipse (PyDev) 27
2.10.4 Sublime 28
2.10.5 Liclipse 29
2.10.6 Ninjaide 29
2.10.7 Komodo IDE 29
2.11 SciPy 30
2.11.1 NumPy 30
2.11.2 Pandas 30
2.11.3 Matplotlib 31
2.12 Summary 31

Python data Analytics-2nd Chapter-ptyhon World Profile

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.