# Overview
*2-3 sentences on the description of the product*
## Summary Characteristics
| Open Source | Paradigm | Typing System | Compilation | D vs. I |
| ----------- | -------- | --------------------- | ----------- | ------- |
| | | [[dynamically typed]] | | |
## Documentation Link(s)
- [PEP 8 – Style Guide for Python Code | peps.python.org](https://peps.python.org/pep-0008/)
## Pro and Cons Summary
### Pros
### Cons
# Key Characteristics
## Key Features
### Variable and Data Type Declarations
#### Numeric Types
- Ints
- When dividing integers a int will be returned based on floor divison
- Floats
- Stored in IEEE 754 floating-point format
- Set, or [[Hash Set]]
- Can be declared using `{}` or `set()`
- Values are added to the set using set.add()
- Dictionary, or [[Hash Table]]
- Access Missing Keys
- `dict.get()` vs. `defaultdict`
- `dict.get()` should be used when:
- You need more control of default values or;
- You are dealing with *occasional* missing keys
- `defaultdict` should be used when:
- Frequency dealing with missing keys AND you have the same default value
- You are working with nested dictionaries or complex data structures
- Lists
- Sorting Lists
- list.sort() method
- Pros:
- In-place sorting (modifies the original list)
- Memory efficient as it doesn't create a new list
- Slightly faster than sorted() for large list
- Cons:
- Modifies the original list, which may not always be desirable
- Returns None, so can't be used in a single line of code with other operations
- sorted() function
- Pros:
- Creates a new sorted list, preserving the original
- Can be used with any iterable, not just lists
- Can be chained with other operations in a single line
- Cons:
- Uses more memory as it creates a new list
- Slightly slower than list.sort() for very large lists
### Control Flow Structures
### Functions
#### Type Annotations or Hint:
A 'hint' on the type that should be used for input parameters into a function.
```python
def get_full_name(first_name: str, last_name: str):
full_name = first_name.title() + " " + last_name.title()
return full_name
```
Can support optional types using the `Optional` class from the `typing` package.
```python
from typing import Optional
def say_hi(name: Optional[str] = None):
if name is not None:
print(f"Hey {name}!")
else:
print("Hello World")
```
### Error Handling Mechanisms
# Use Cases
# Performance
## Memory Management
## [[Concurrency and Parallelism]] Support
# Ecosystem and Integration
## [[Integrated Development Environments]] (IDEs)
## Package Managers and Dependency Management
### Packages
In Python, there are various ways to run and use a file. Depending on how the Python file is used, it may be considered a script, module, or package. When the file is being loaded as the top-level item (i.e., `python myfile.py`) it is simply being run as a script. There can only be one top-level script at a time. Within the script, you can load other Python files via `import`. This is considered loading a module.
When the top-level script is loaded, the `__name__` attribute is loaded as `__main__`. When the modules are imported, then the name is `folder1.subfolder1.module.py`. But, the Python interpreter adds the current directory to its search path when the interpreter is entered. This means the directory of the `__main__ `file is included in the search by default, and the folder names in the directory do not need to be explicitly written.
#### Relative Package Imports
The relative package imports using dot notation `from .. import module` uses the names to determine the location of the package. Thus, you must consider where the import statement is location and where the `__main__` file is being loaded. Relative imports within the `__main__` file does not work, because it is not seen as being in the package and the `__name__` of `__main__` doesn't have any folders to use for the relative import.
There are methods for the package to come from the current working directory, rather than the directory where the `__main__` script is being executed, which can be referenced here: [python - Relative imports for the billionth time - Stack Overflow](https://stackoverflow.com/questions/14132789/relative-imports-for-the-billionth-time)
# Interoperability
# Documentation Links
## Standard Libraries and Modules
- [[Pandas]]
## Reference
#### Working Notes
#### Sources
- [styleguide \| Style guides for Google-originated open-source projects](https://google.github.io/styleguide/pyguide.html)
#### Topics to Cover
- Dataframes
- Classes
- Methods
- try / except
- Chaining
- Libraries
- Data Manipulation
- Pandas
- Numpy
- Data Science
- scikit-learn
- tensorflow
- Streamlit
#### Related Topics
-