Skip to content

Commit

Permalink
Adding minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcsrodriguez committed Jul 16, 2022
1 parent 5993384 commit 8ce9277
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ If you choose the cloning method, please perform a prelinimary step: installing
| Raw set | `set` | "Pure" Python set (set of lists) ||
| Raw dict | `dict` | "Pure" Python dict (dict of lists) ||
| Numpy | `ndarray` | Numpy n-dimensions array (for fast computations) (underlying C-layers) ||
| Numpy | `record` | Numpy record array ||
| Pandas | `Series` | Pandas Series conversion (for multiple signals, return a list of Series) ||
| Pandas | `DataFrame` | Pandas DataFrame conversion (best solution for further data processing) ||
| HDFS | - | Hadoop Distributed File System (HDFS) *(using PyArrow)* ||
Expand Down
25 changes: 4 additions & 21 deletions headat/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"txt": {
"extension": "txt",
"method": "custom",
"callback": "t_txt"
},
"out": {
"extension": "out",
Expand All @@ -14,10 +15,12 @@
"xlsx": {
"extension": "xlsx",
"method": "to_excel",
"callback": "t_xlsx"
},
"csv": {
"extension": "csv",
"method": "to_csv",
"callback": "t_csv"
},
"json": {
"extension": "json",
Expand Down Expand Up @@ -65,24 +68,4 @@
}
}
EXPORT_FOLDERS = "out"
EXCEL_ROW_LIMIT = 1048576 - 2


"""
try:
if formats[format]["method"] == "custom":
print(f"Not yet supported for {format}")
return False
if format in ["json", "pickle"]:
# Error with the JSON format: 'index=False' is only valid when 'orient' is 'split' or 'table'
eval(f"df.{formats[format]['method']}(self.folder_name + f'out_{get_current_datetime()}.{formats[format]['extension']}')")
elif format == "latex":
eval(f"df.{formats[format]['method']}(self.folder_name + f'out_{get_current_datetime()}.{formats[format]['extension']}')")
else:
eval(f"df.{formats[format]['method']}(self.folder_name + f'out_{get_current_datetime()}.{formats[format]['extension']}', index=False)")
print(f"Export finished for {format} format")
return True
except Exception as e:
print(e)
return False
"""
EXCEL_ROW_LIMIT = 1048576 - 2
5 changes: 2 additions & 3 deletions headat/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
from pyspark.sql import SparkSession
from .lib.functions import *

if os.path.exists(EXPORT_FOLDERS) and os.path.isdir(EXPORT_FOLDERS):
pass
else:

if not os.path.exists(EXPORT_FOLDERS) or not os.path.isdir(EXPORT_FOLDERS):
os.mkdir(EXPORT_FOLDERS)


Expand Down
2 changes: 0 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pandas as pd

from headat.main import *


Expand Down

0 comments on commit 8ce9277

Please sign in to comment.