# My Python Cheatsheet

### Lists

### Dictionaries

### Modules

*Packages*(e.g. pyspark) contain*modules*(e.g. pyspark.sql), which in turn define classes, functions, etc. (e.g. pyspark.sql.HiveContext(SparkContext)).- Load a package or a module by issuing
`import numpy`

. You can then access its functions by`numpy.array([2,4,6])`

. If you want to type less, you can import`numpy`

as`np`

, which allows you to call`np.array([2,4,6])`

. - You can hand-pick single functions with
`from numpy import array`

and can then directly call`array([2,4,6])`

, but this is discouraged as it could lead to namespace clashes. - A possibility (although not recommended) is to use
`from numpy import *`

. This imports all definitions in numpy directly. Again, not recommended.

### Functional programming

The following two versions are equivalent: