Creating DataFrame from json that contains "index" key/property causes error
See original GitHub issueThe Following Code:
const jsonData = [{name:'test1',index: 0},{name:'test2',index: 1}]
const df = new dfd.DataFrame(jsonData);
This will cause the error: UnhandledPromiseRejectionWarning: TypeError: Cannot set property index of [object Object] which has only a getter
Looks like within the DataFrame class “index” is reserved
class DataFrame extends _generic.default {
constructor(data, kwargs) {
super(data, kwargs);
this.__set_column_property();
}
__set_column_property() {
let col_vals = this.col_data;
let col_names = this.column_names;
col_vals.forEach((col, i) => {
this[col_names[i]] = null; <<<< Error happens here
Object.defineProperty(this, col_names[i], {
get() {
return new _series.Series(this.col_data[i], {
columns: col_names[i],
index: this.index
});
},
set(value) {
this.addColumn({
column: col_names[i],
value: value
});
}
});
});
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Reading Json file as Pandas Dataframe error - Stack Overflow
I think you can use modul json for reading file.json and then DataFrame constructor : import pandas as pd import json with open('file.json') ......
Read more >Three Cases When Parsing JSON Documents In A Python ...
Python Pandas DataFrame convert and normalise JSON documents objects with NULL ... we have to make up the dictionary using the indexes of...
Read more >pandas.DataFrame.to_json — pandas 1.5.2 documentation
Whether to include the index values in the JSON string. Not including the index ( index=False ) is only supported when orient is...
Read more >Indexer errors and warnings - Azure Cognitive Search
Ensure all documents have valid document keys. The document key is determined by setting the 'key' property as part of the index definition....
Read more >Loading JSON data from Cloud Storage | BigQuery
create. Each of the following predefined IAM roles includes the permissions that you need in order to load data into a BigQuery table...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The same happens if
sizekey is present in data.Stale issue message