3 Data Science Tips That You Might Have Missed 5
3 Data Science Tips That You Might Have Missed 5
My favorite tool to handle config files is Hydra. The code below shows
how to get values from a config file using Hydra.
# config.yml
data: data1
variables:
drop_features: ['iid', 'id', 'idg', 'wave']
# main.py
import hydra
@hydra.main(config_name='config.yml')
def main(config):
print(f'Process {config.data}')
print(f'Drop features:
{config.variables.drop_features}')
if __name__ == '__main__':
main()
Output:
Process data1
Drop features: ['iid', 'id', 'idg', 'wave'
class Food:
self.color = color
Have you ever looked at a function you wrote one month earlier and
found it difficult to understand in 3 minutes? If that is the case, it is
time to refactor your code.
be small
do one thing
contain code with the same level of abstraction
have fewer than 4 arguments
have no duplication
use descriptive names
In this article, you will learn how to utilize 6 practices mentioned above
to write better Python functions.