Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Timeseries from .dt or toDateTime() to Series or DataFrame throws "Error: File format not supported!" #363

Closed
Emporea opened this issue Jan 20, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@Emporea
Copy link

Emporea commented Jan 20, 2022

I tested it with danfojs-node and danfojs-node-nightly, because danfo.Dt includes the nightly.

What I have so far is this. Not a dt or danfo.toDateTime() operation yet.

const danfo = require("danfojs-node-nightly");

let index = ["0", "1", "2", "3"];
let value = [
  "2018-11-30T20:59:00",
  "2018-10-30T20:59:00",
  "2018-09-30T20:59:00",
  "2018-08-30T20:59:00",
];

let sf = new danfo.Series(value, { index });

console.log(sf.dt);

This is working and gives this. Danfo succesfully recognizes this string as a date.

TimeSeries {
  '$dateObjectArray': [
    2018-11-30T20:59:00.000Z,
    2018-10-30T20:59:00.000Z,
    2018-09-30T20:59:00.000Z,
    2018-08-30T20:59:00.000Z
  ]
}

But if I have a DataFrame where one column are dates then it is not possible to insert it into the DataFrame.
Any single one of these functions results in the same error. Obviously only for demonstration all 4 in a row.

df["dates"] = df["dates"].dt
df["dates"] = danfo.toDateTime(dt["dates"])
let test_df = new danfo.DataFrame(sf.dt);
let test_sf = new danfo.Series(sf.dt);

Error: File format not supported!

@risenW
Copy link
Member

risenW commented Jan 20, 2022

I tested it with danfojs-node and danfojs-node-nightly, because danfo.Dt includes the nightly.

What I have so far is this. Not a dt or danfo.toDateTime() operation yet.

const danfo = require("danfojs-node-nightly");

let index = ["0", "1", "2", "3"];
let value = [
  "2018-11-30T20:59:00",
  "2018-10-30T20:59:00",
  "2018-09-30T20:59:00",
  "2018-08-30T20:59:00",
];

let sf = new danfo.Series(value, { index });

console.log(sf.dt);

This is working and gives this. Danfo succesfully recognizes this string as a date.

TimeSeries {
  '$dateObjectArray': [
    2018-11-30T20:59:00.000Z,
    2018-10-30T20:59:00.000Z,
    2018-09-30T20:59:00.000Z,
    2018-08-30T20:59:00.000Z
  ]
}

But if I have a DataFrame where one column are dates then it is not possible to insert it into the DataFrame. Any single one of these functions results in the same error. Obviously only for demonstration all 4 in a row.

df["dates"] = df["dates"].dt
df["dates"] = danfo.toDateTime(dt["dates"])
let test_df = new danfo.DataFrame(sf.dt);
let test_sf = new danfo.Series(sf.dt);

Error: File format not supported!

This is related to this feature request #321 At the moment DateTime is not a standard data type in Danfojs. We will work on this pretty soon.

@risenW risenW added enhancement New feature or request duplicate This issue or pull request already exists labels Jan 20, 2022
@risenW
Copy link
Member

risenW commented Oct 12, 2022

Fixed in #511

@risenW risenW closed this as completed Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants