Importing Teradata Package for Python modules using wildcard '*' or specific modules can lead to namespace collisions which overwrites the variable names used.
Example:
>>> import pandas as pd >>> data = pd.read_csv(r"./sample.csv") >>> print(type(data)) <class 'pandas.core.frame.DataFrame'> >>> from teradataml import * >>> print(type(data)) <class 'module'>
'data' is one of the module names in Teradata Package for Python and local variable 'data' which holds csv data is replaced by the module object.
To avoid the overwriting issue:
- Avoid wildcard imports: Instead of using 'from package import *', explicitly import only the necessary components. For example:
>>> from teradataml import specific_module
- Use aliases: If you need to import a module with a common name, use an alias to avoid conflicts. For example:
>>> import teradataml.data as td_data