home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where user = 12130884 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • DavidTsangHW · 1 ✖

issue 1

  • timedelta64[D] is always coerced to timedelta64[ns] 1

author_association 1

  • NONE 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
417337306 https://github.com/pydata/xarray/issues/1143#issuecomment-417337306 https://api.github.com/repos/pydata/xarray/issues/1143 MDEyOklzc3VlQ29tbWVudDQxNzMzNzMwNg== DavidTsangHW 12130884 2018-08-30T14:21:55Z 2018-08-30T14:21:55Z NONE

Pardon me for extending this discussion.

I encountered the same problem when calculating timedelta in a dataframe. It even ended with an error when I tried to call the days attribute. I am using Numpy 1.6.1

AttributeError: 'Series' object has no attribute 'days'

Problem

df_trans['DELTA'] = df_trans['DATE2'] - df_trans['DATE1']

print df_trans['DELTA'].dtype

timedelta64[ns]

print df_trans['DELTA']

0 8 days, 00:00:00 1 15 days, 00:00:00 2 5 days, 00:00:00

df_trans['DELTA'] = df_trans['DELTA'].astype('timedelta64[D]') print df_trans['DELTA'].dtype

Name: DELTA, dtype: timedelta64[D]

print df_trans['DELTA']

0 8 days, 00:00:00 1 15 days, 00:00:00 2 5 days, 00:00:00 Nothing changed at all

print df_trans['DELTA'].days

AttributeError: 'Series' object has no attribute 'days'

I get rid of the problem by putting it in to a list for the conversion.

            Ss_timedelta = df_trans['DATE2'] - df_trans['DATE1']
            ls_timedelta = Ss_timedelta.values.astype('timedelta64[D]').tolist()
            for i in range(0, len(ls_timedelta)):
                    ls_timedelta[i] = ls_timedelta[i].days / 1000                        
            df_trans['HOLDDAYS'] = pd.Series(ls_timedelta)
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  timedelta64[D] is always coerced to timedelta64[ns] 192325490

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 11.736ms · About: xarray-datasette