Skip to content

Commit df3a131

Browse files
authored
fix(pandas): update compatibility (#28)
* Instead of directly appending a dictionary to the DataFrame, we create a new DataFrame called new_row that contains the data we want to add We use pd.concat() to concatenate the original DataFrame (frame) with the new DataFrame (new_row). The ignore_index=True parameter ensures that the index is reset after concatenation * Added more descriptive comments on the changes that I made * Update __init__.py
1 parent 7189ada commit df3a131

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

dgraphpandas/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__name__ = 'dgraphpandas'
2-
__version__ = '0.1.4'
2+
__version__ = '0.1.5'
33
__description__ = 'Transform Pandas DataFrames into Exports to be sent to DGraph'
44

55
from dgraphpandas.rdf import to_rdf # noqa

dgraphpandas/strategies/schema.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ def create_schema(source_config: Union[str, Dict[str, Any]], output_dir='.', **k
137137

138138
logger.debug('Appending xid declaration')
139139
if ensure_xid_predicate:
140-
frame = frame.append({'column': 'xid', 'type': 'string', 'table': None, 'options': '@index(exact)'}, ignore_index=True)
140+
# Create a new DataFrame for the row to be added
141+
new_row = pd.DataFrame([{'column': 'xid', 'type': 'string', 'table': None, 'options': '@index(exact)'}])
142+
# Use pd.concat to add the new row
143+
frame = pd.concat([frame, new_row], ignore_index=True)
141144

142145
frame.sort_values(by=['table', 'type'], inplace=True)
143146
frame.reset_index(inplace=True, drop=True)

0 commit comments

Comments
 (0)