Programming an der Universidade Nova De Lisboa | Karteikarten & Zusammenfassungen

Lernmaterialien für Programming an der Universidade Nova de Lisboa

Greife auf kostenlose Karteikarten, Zusammenfassungen, Übungsaufgaben und Altklausuren für deinen Programming Kurs an der Universidade Nova de Lisboa zu.

TESTE DEIN WISSEN

Pandas: Key points Series

Lösung anzeigen
TESTE DEIN WISSEN
• Each series has only one data type (even if it is a more inclusive one, like object).

• A list of indexes might be used (it has to have the same dimension).
• It is possible to use dictionaries to create series.

Lösung ausblenden
TESTE DEIN WISSEN

Pandas - DataFrames - Keypoints

Lösung anzeigen
TESTE DEIN WISSEN
• DataFrames may be seen as a tabular structure (named rows and columns).

• We can define the indexes and columns as we create the dataframe.

• It possible to take advantage of dictionaries and Series to create DataFrames.

• To add the new columns of data it is not necessary to create a new dataframe.

Lösung ausblenden
TESTE DEIN WISSEN

Pandas - Further Key points DataFrames

Lösung anzeigen
TESTE DEIN WISSEN
• It possible to print the dataframe (still shows too many lines, might be too “noisy”).

• head() and tail() print the n top and bottom, respectively, lines of the dataframe.

• Count returns the number of entries for each column that are not null.

• Info returns the number of entries, the number of columns, their counts and the data type.

• Describe returns basic statistical information of the numeric columns.

Lösung ausblenden
TESTE DEIN WISSEN

Classes

Instantiation

Lösung anzeigen
TESTE DEIN WISSEN

A class doesn’t accomplish anything simply by being defined. A class must be instantiated. In other words, we must create an instance of the class, in order to breathe life into the schematic.

Instantiating a class looks a lot like calling a function.  We would be able to create an instance of our defined CoolClass as follows:

cool_instance = CoolClass()

#cool_instance is the instance

#CoolClass() is the class

Lösung ausblenden
TESTE DEIN WISSEN
Definition & Usage Dictionary
Lösung anzeigen
TESTE DEIN WISSEN
- a unordered and mutable sequence of key-value pairs enclosed by {} and separated by ,
- the key-value pairs can be accessed by the key
- the keys cant be duplicated
- keys can not be of any type —> type must be immutable (string, tuple, float etc.)
- but values can be of any t
- to put it simple a dictionary is a storage that aims to map different keys to different values

why / Usage
- helps to make code more seamless
- need to associate two things its very helpful —> more structured
Lösung ausblenden
TESTE DEIN WISSEN

Definition & Usage Loops

Lösung anzeigen
TESTE DEIN WISSEN

General:

- sth that happens multiple times

- two different types of loops

For loop

- a for loop iterates over a certain sequences of objects over and over again

- as a result of that it executes a block of code repeadly for each individual sequence

- consists of

- for keyword

- a variable that can be chosen by oneself its kind of a placeholder and takes the value the next object in iterable each time it loops

- the iterable is the object to loop over

while loop

- a while loop iterates over a certain sequence over and over again as long as the condition is true

- consists of the while keyword and the condition that evaluates always to true or false

Why  / Usage

- if you need to do things several times loops in general safe a lot of lines of code because sth what would have been done manually can be done with a simple line of code --> code reusability

- give control of what to execute under defined conditions

- if you need to do things based on conditions

- supports by altering the flow of a program

Examples
- trade stock depending on current value
- execute 10 trades in stock
Lösung ausblenden
TESTE DEIN WISSEN
Definition and usage List
Lösung anzeigen
TESTE DEIN WISSEN
- ordered and mutable sequence of items enclosed by [] and seperated by ,
- an be accessed by an index
- it is changable and can be duplicated
- can consist of different types

Why using?
- want to have a simple collection of things of similar or different data types and be able to change them
Lösung ausblenden
TESTE DEIN WISSEN
Definition & Usage Sets
Lösung anzeigen
TESTE DEIN WISSEN
- unordered collection of values
- the collection itself is mutable but the elements are unchangeable
- they can not be accessed by an index and are not duplicatable
- but they can contain elements of different types
- similar to sets in mathematics

Why / Usage
- very useful to remove duplicate values from lists or tuples in an efficient way
- useful to perform common math operations e.g intersects or unions
Lösung ausblenden
TESTE DEIN WISSEN
Definition & Usage Tuple
Lösung anzeigen
TESTE DEIN WISSEN
- A ordered sequences of items that is unmutable.
is enclosed by ()
- it can be accessed by index
- can be duplicated
-  can consist of different types
- but items are not changeable

why? Usage?
- if you want to store a collection of things that do not need to be changed
Lösung ausblenden
TESTE DEIN WISSEN

Definition & Usage Functions

Lösung anzeigen
TESTE DEIN WISSEN

- a function is simply a block of code that takes input, performs a certain task with that input using several operations and based on that returns an output

- Within a function basically, every kind of code that normally works outside the function can be added (loops, lists, tuples etc)

- to make a function work we need to call it --> returns values asked for

- Python offers certain build-in function like the print() function but it is also possible to create own function (custom functions)

Usage / Why

- reusability

- avoid repeating code thereby safes lines of code; function needs just to be called and input for arguements to be changed.

- decrease level of complexity

- easier to share code with others

- build logical structure by dividing taks in smaller pieces --> easier to read, test and reuse  insted we can

Lösung ausblenden
TESTE DEIN WISSEN

Definition & Usage Pandas

Lösung anzeigen
TESTE DEIN WISSEN

that provides data structures and analysis tools directly made for Python by doing so we can load data into a certain structure and extract values needed in an easy way.

Why  / Usage

- creates a very clear way of presenting data (e.g. Dataframes have table structure)

-  easy to read, to analyze, to transform, to manipulate and to print

- serveral features support this and enable to filter, segment or segretate (a little bit like excel) in the way needed

- shorten proceture of handling data

- able to handle a large amount of data --> able to import large number of data fast and efficient

- able to do some things not possible e.g. in dictionaries

Lösung ausblenden
TESTE DEIN WISSEN

Definition & Usage Classes

Lösung anzeigen
TESTE DEIN WISSEN

- kind of blueprint or template for creating objects

Usage / Why

- keep certain things common but allow for customization where needed --> inheritance --> possibilty to override if needed but all data are kept at certain spot

- abiltiy to change objects together

- ability to create an own data typ

- helps to make programs more organized and powerful

Lösung ausblenden
• 1210 Karteikarten
• 71 Studierende
• 0 Lernmaterialien

Beispielhafte Karteikarten für deinen Programming Kurs an der Universidade Nova de Lisboa - von Kommilitonen auf StudySmarter erstellt!

Q:

Pandas: Key points Series

A:
• Each series has only one data type (even if it is a more inclusive one, like object).

• A list of indexes might be used (it has to have the same dimension).
• It is possible to use dictionaries to create series.

Q:

Pandas - DataFrames - Keypoints

A:
• DataFrames may be seen as a tabular structure (named rows and columns).

• We can define the indexes and columns as we create the dataframe.

• It possible to take advantage of dictionaries and Series to create DataFrames.

• To add the new columns of data it is not necessary to create a new dataframe.

Q:

Pandas - Further Key points DataFrames

A:
• It possible to print the dataframe (still shows too many lines, might be too “noisy”).

• head() and tail() print the n top and bottom, respectively, lines of the dataframe.

• Count returns the number of entries for each column that are not null.

• Info returns the number of entries, the number of columns, their counts and the data type.

• Describe returns basic statistical information of the numeric columns.

Q:

Classes

Instantiation

A:

A class doesn’t accomplish anything simply by being defined. A class must be instantiated. In other words, we must create an instance of the class, in order to breathe life into the schematic.

Instantiating a class looks a lot like calling a function.  We would be able to create an instance of our defined CoolClass as follows:

cool_instance = CoolClass()

#cool_instance is the instance

#CoolClass() is the class

Q:
Definition & Usage Dictionary
A:
- a unordered and mutable sequence of key-value pairs enclosed by {} and separated by ,
- the key-value pairs can be accessed by the key
- the keys cant be duplicated
- keys can not be of any type —> type must be immutable (string, tuple, float etc.)
- but values can be of any t
- to put it simple a dictionary is a storage that aims to map different keys to different values

why / Usage
- helps to make code more seamless
- need to associate two things its very helpful —> more structured
Q:

Definition & Usage Loops

A:

General:

- sth that happens multiple times

- two different types of loops

For loop

- a for loop iterates over a certain sequences of objects over and over again

- as a result of that it executes a block of code repeadly for each individual sequence

- consists of

- for keyword

- a variable that can be chosen by oneself its kind of a placeholder and takes the value the next object in iterable each time it loops

- the iterable is the object to loop over

while loop

- a while loop iterates over a certain sequence over and over again as long as the condition is true

- consists of the while keyword and the condition that evaluates always to true or false

Why  / Usage

- if you need to do things several times loops in general safe a lot of lines of code because sth what would have been done manually can be done with a simple line of code --> code reusability

- give control of what to execute under defined conditions

- if you need to do things based on conditions

- supports by altering the flow of a program

Examples
- trade stock depending on current value
- execute 10 trades in stock
Q:
Definition and usage List
A:
- ordered and mutable sequence of items enclosed by [] and seperated by ,
- an be accessed by an index
- it is changable and can be duplicated
- can consist of different types

Why using?
- want to have a simple collection of things of similar or different data types and be able to change them
Q:
Definition & Usage Sets
A:
- unordered collection of values
- the collection itself is mutable but the elements are unchangeable
- they can not be accessed by an index and are not duplicatable
- but they can contain elements of different types
- similar to sets in mathematics

Why / Usage
- very useful to remove duplicate values from lists or tuples in an efficient way
- useful to perform common math operations e.g intersects or unions
Q:
Definition & Usage Tuple
A:
- A ordered sequences of items that is unmutable.
is enclosed by ()
- it can be accessed by index
- can be duplicated
-  can consist of different types
- but items are not changeable

why? Usage?
- if you want to store a collection of things that do not need to be changed
Q:

Definition & Usage Functions

A:

- a function is simply a block of code that takes input, performs a certain task with that input using several operations and based on that returns an output

- Within a function basically, every kind of code that normally works outside the function can be added (loops, lists, tuples etc)

- to make a function work we need to call it --> returns values asked for

- Python offers certain build-in function like the print() function but it is also possible to create own function (custom functions)

Usage / Why

- reusability

- avoid repeating code thereby safes lines of code; function needs just to be called and input for arguements to be changed.

- decrease level of complexity

- easier to share code with others

- build logical structure by dividing taks in smaller pieces --> easier to read, test and reuse  insted we can

Q:

Definition & Usage Pandas

A:

that provides data structures and analysis tools directly made for Python by doing so we can load data into a certain structure and extract values needed in an easy way.

Why  / Usage

- creates a very clear way of presenting data (e.g. Dataframes have table structure)

-  easy to read, to analyze, to transform, to manipulate and to print

- serveral features support this and enable to filter, segment or segretate (a little bit like excel) in the way needed

- shorten proceture of handling data

- able to handle a large amount of data --> able to import large number of data fast and efficient

- able to do some things not possible e.g. in dictionaries

Q:

Definition & Usage Classes

A:

- kind of blueprint or template for creating objects

Usage / Why

- keep certain things common but allow for customization where needed --> inheritance --> possibilty to override if needed but all data are kept at certain spot

- abiltiy to change objects together

- ability to create an own data typ

- helps to make programs more organized and powerful

Erstelle und finde Lernmaterialien auf StudySmarter.

Greife kostenlos auf tausende geteilte Karteikarten, Zusammenfassungen, Altklausuren und mehr zu.

TU Dortmund