Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

get_data.py 767 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  1. # Read params
  2. # process
  3. # return dataframe
  4. import os
  5. import yaml
  6. import pandas as pd
  7. import argparse
  8. def read_params(config_path):
  9. with open(config_path) as yaml_file:
  10. config = yaml.safe_load(yaml_file)
  11. return config
  12. def get_data(config_path):
  13. config = read_params(config_path)
  14. #print(config)
  15. # getting the path for data
  16. data_path = config["data_source"]["s3_source"]
  17. df = pd.read_csv(data_path,sep=",",encoding = 'utf-8')
  18. #print(df.head())
  19. return df
  20. # simple comment
  21. if __name__ == "__main__":
  22. args = argparse.ArgumentParser()
  23. # we just reading the params.yaml
  24. args.add_argument("--config",default = "params.yaml")
  25. parsed_args = args.parse_args()
  26. data = get_data(config_path = parsed_args.config)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...