




























Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!





























The 'int' object is not sub-scriptable:
Tuples are often used as function parameters: this prevents the code within the function from changing the values of the parameters during the function call.
The range type represents an immutable sequence of numbers and is commonly used for looping a specific number of times in for loops (stop element is always excluded):
Imagine you wrote a program with 10000 lines of code: if you put all the code in one file, it would be difficult to navigate and maintain it. Programmers solve this issue by dividing large programs into multiple pieces, called modules: each module contains pieces of code. Python allows you to use code from one module in another module and has built-in modules and you can directly use them after importing. Python also has modules that must be installed before importing and using them. To import a module, the Python syntax is: Once you have imported a module, you can use code from it, by using the syntax: In most of the signal processing exercises we will use the following external modules:
NumPy can handle multidimensional ndarrays; below there’s an example of declaring a 2 - dimensional ndarray (the parameter consists of a list of lists of identical length and each sublist describes the contents of one row): To obtain the shape of an ndarray, simply access its attribute shape, by using the syntax: Algebraic operations:
Subplots:
For a DataFrame, passing a single label selects a columns and yields a Series equivalent to df.Age: For a DataFrame, passing a slice means select matching rows: We can select by position using DataFrame.iloc(). Select via the position of the passed integers: Integer slices acts like NumPy/Python: Lists of integer position locations: For slicing rows and columns explicitly: For getting a value explicitly:
For NumPy data types, np.nan represents missing data : it’s by default not included in computations. DataFrame.dropna() drops any rows that have missing data: Statistics : operations in general exclude missing data. Calculate the mean value for each column: