parseDates() formatting not working
See original GitHub issueI’m using the data-forge-ts library in an Angular project and I’m unable to get the date to convert to the desired format. I’m not sure if I’m doing something wrong or if there’s an issue with the library.
A minimal example is here:
https://stackblitz.com/edit/date-sandbox-data-forge-ts?file=app/app.component.ts
The input date format is:
"03/01/2021"
This line of code:
const df = idf.parseDates("date");
results in a date that looks like:
Mon Mar 01 2021 00:00:00 GMT-0600 (Central Standard Time)
This line of code:
const df = idf.parseDates("date", "YYYY-MM-DD");
results in
Invalid Date
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Can pandas automatically read dates from a CSV file?
However, I have a column that has dates in the following format: 2013-6-4 . These dates were recognized as strings (not as python...
Read more >4 tricks you should know to parse date columns with Pandas ...
In this article, we will cover the following most common parse date columns problems: Reading date columns from a CSV file; Day first...
Read more >BUG: pd.read_csv not correctly parsing date/month field when ...
I ran in to this bug while trying to parse the few dates through parse_dates of pandas.read_csv() . In the following code snippet, ......
Read more >pandas.read_csv — pandas 1.5.2 documentation
If True and parse_dates is enabled, pandas will attempt to infer the format of the datetime strings in the columns, and if it...
Read more >DateTime in pandas read_csv(): Everything you have to know
Set parse_date parameter of read_csv() to label/index of the column you want to parse(convert string date into datetime object).
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 FreeTop 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
Top GitHub Comments
That’s a good assumption.
By the way thanks for providing the sample code, that makes it really easy to give help.
So in my real application, I’m acquiring a list of transactions from a nestjs backend and the date format is as it comes from MySQL (e.g. 2020-07-19). I’m trying to build an interface that can provide different views of the data. I’m hoping that I can use data-forge to manipulate the DataFrame to different formats. For example, the real data would have some value (e.g. dollars) as a series in the dataframe. I would like to manipulate the dataframe from a transaction list to a time table (with the dates as series). In addition, I would like to be able to change the resolution of the date series (e.g. daily, weekly, bi-weekly, etc.). I have no idea how to do any of that yet, but I was assuming my string dates need to be typed as dates.