I am working on a NextJs page. I have used axios with usestate and useeffect to retreive json data from a web api into a const state apiData'.
.then((res) => {
setApiData(res.data.Projects);
console.log(res.data.Projects);
})
Here is the console.log output:
[
{
Name: Project1,
Number: DM-01
},
{Name: Project 2, Number: DM 02}
]
Now, I am able to console.log or apiData.map the data in the nextjs application. But I am unable to map the apiData to danfo dataframe:
const df = new Danfo.DataFrame(apiData)
console.log(df.columns)
I and trying to assign the json received from axios to danfo dataframe.
To print denfo dataframe, you should use
df.print()function. Also make sure yourapiDatais notnullbefore assigning it todf.