Spaces:
Build error
Build error
Commit
·
a4a1c61
1
Parent(s):
203bb0f
Added map_dtype_to_weaviate function
Browse files
app.py
CHANGED
|
@@ -18,6 +18,19 @@ client = weaviate.Client(
|
|
| 18 |
embedded_options=EmbeddedOptions()
|
| 19 |
)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def ingest_data_to_weaviate(dataframe, class_name, class_description):
|
| 22 |
# Create class schema
|
| 23 |
class_schema = {
|
|
|
|
| 18 |
embedded_options=EmbeddedOptions()
|
| 19 |
)
|
| 20 |
|
| 21 |
+
def map_dtype_to_weaviate(dtype):
|
| 22 |
+
"""
|
| 23 |
+
Map pandas data types to Weaviate data types.
|
| 24 |
+
"""
|
| 25 |
+
if "int" in str(dtype):
|
| 26 |
+
return "int"
|
| 27 |
+
elif "float" in str(dtype):
|
| 28 |
+
return "number"
|
| 29 |
+
elif "bool" in str(dtype):
|
| 30 |
+
return "boolean"
|
| 31 |
+
else:
|
| 32 |
+
return "string"
|
| 33 |
+
|
| 34 |
def ingest_data_to_weaviate(dataframe, class_name, class_description):
|
| 35 |
# Create class schema
|
| 36 |
class_schema = {
|