forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumPy.datetime.gen.cs
More file actions
332 lines (323 loc) · 14.1 KB
/
NumPy.datetime.gen.cs
File metadata and controls
332 lines (323 loc) · 14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
// Copyright (c) 2019 by the SciSharp Team
// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Python.Runtime;
using Numpy.Models;
namespace Numpy
{
public partial class NumPy
{
/// <summary>
/// Convert an array of datetimes into an array of strings.
/// </summary>
/// <param name="arr">
/// The array of UTC timestamps to format.
/// </param>
/// <param name="unit">
/// One of None, ‘auto’, or a datetime unit.
/// </param>
/// <param name="timezone">
/// Timezone information to use when displaying the datetime.<br></br>
/// If ‘UTC’, end
/// with a Z to indicate UTC time.<br></br>
/// If ‘local’, convert to the local timezone
/// first, and suffix with a +-#### timezone offset.<br></br>
/// If a tzinfo object,
/// then do as with ‘local’, but use the specified timezone.
/// </param>
/// <param name="casting">
/// Casting to allow when changing between datetime units.
/// </param>
/// <returns>
/// An array of strings the same shape as arr.
/// </returns>
public NDarray datetime_as_string(string[] arr, string unit, string timezone = "naive", string casting = "same_kind")
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
arr,
unit,
});
var kwargs=new PyDict();
if (timezone!="naive") kwargs["timezone"]=ToPython(timezone);
if (casting!="same_kind") kwargs["casting"]=ToPython(casting);
dynamic py = __self__.InvokeMethod("datetime_as_string", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Get information about the step size of a date or time type.<br></br>
///
/// The returned tuple can be passed as the second argument of numpy.datetime64 and
/// numpy.timedelta64.
/// </summary>
/// <param name="dtype">
/// The dtype object, which must be a datetime64 or timedelta64 type.
/// </param>
/// <returns>
/// A tuple of:
/// unit
/// The datetime unit on which this dtype
/// is based.
/// count
/// The number of base units in a step.
/// </returns>
public (string, int) datetime_data(Dtype dtype)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dtype,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("datetime_data", pyargs, kwargs);
var t = py as PyTuple;
return (ToCsharp<string>(t[0]), ToCsharp<int>(t[1]));
}
/*
/// <summary>
/// A business day calendar object that efficiently stores information
/// defining valid days for the busday family of functions.<br></br>
///
/// The default valid days are Monday through Friday (“business days”).<br></br>
///
/// A busdaycalendar object can be specified with any set of weekly
/// valid days, plus an optional “holiday” dates that always will be invalid.<br></br>
///
/// Once a busdaycalendar object is created, the weekmask and holidays
/// cannot be modified.
/// </summary>
/// <param name="weekmask">
/// A seven-element array indicating which of Monday through Sunday are
/// valid days.<br></br>
/// May be specified as a length-seven list or array, like
/// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string
/// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for
/// weekdays, optionally separated by white space.<br></br>
/// Valid abbreviations
/// are: Mon Tue Wed Thu Fri Sat Sun
/// </param>
/// <param name="holidays">
/// An array of dates to consider as invalid dates, no matter which
/// weekday they fall upon.<br></br>
/// Holiday dates may be specified in any
/// order, and NaT (not-a-time) dates are ignored.<br></br>
/// This list is
/// saved in a normalized form that is suited for fast calculations
/// of valid days.
/// </param>
/// <returns>
/// A business day calendar object containing the specified
/// weekmask and holidays values.
/// </returns>
public busdaycalendar busdaycalendar(string weekmask = null, string[] holidays = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (weekmask!=null) kwargs["weekmask"]=ToPython(weekmask);
if (holidays!=null) kwargs["holidays"]=ToPython(holidays);
dynamic py = __self__.InvokeMethod("busdaycalendar", pyargs, kwargs);
return ToCsharp<busdaycalendar>(py);
}
*/
/*
/// <summary>
/// Calculates which of the given dates are valid days, and which are not.
/// </summary>
/// <param name="dates">
/// The array of dates to process.
/// </param>
/// <param name="weekmask">
/// A seven-element array indicating which of Monday through Sunday are
/// valid days.<br></br>
/// May be specified as a length-seven list or array, like
/// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string
/// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for
/// weekdays, optionally separated by white space.<br></br>
/// Valid abbreviations
/// are: Mon Tue Wed Thu Fri Sat Sun
/// </param>
/// <param name="holidays">
/// An array of dates to consider as invalid dates.<br></br>
/// They may be
/// specified in any order, and NaT (not-a-time) dates are ignored.<br></br>
///
/// This list is saved in a normalized form that is suited for
/// fast calculations of valid days.
/// </param>
/// <param name="busdaycal">
/// A busdaycalendar object which specifies the valid days.<br></br>
/// If this
/// parameter is provided, neither weekmask nor holidays may be
/// provided.
/// </param>
/// <param name="out">
/// If provided, this array is filled with the result.
/// </param>
/// <returns>
/// An array with the same shape as dates, containing True for
/// each valid day, and False for each invalid day.
/// </returns>
public NDarray<bool> is_busday(string[] dates, string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, NDarray<bool> @out = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dates,
});
var kwargs=new PyDict();
if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask);
if (holidays!=null) kwargs["holidays"]=ToPython(holidays);
if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("is_busday", pyargs, kwargs);
return ToCsharp<NDarray<bool>>(py);
}
*/
/*
/// <summary>
/// First adjusts the date to fall on a valid day according to
/// the roll rule, then applies offsets to the given dates
/// counted in valid days.
/// </summary>
/// <param name="dates">
/// The array of dates to process.
/// </param>
/// <param name="offsets">
/// The array of offsets, which is broadcast with dates.
/// </param>
/// <param name="roll">
/// How to treat dates that do not fall on a valid day.<br></br>
/// The default
/// is ‘raise’.
/// </param>
/// <param name="weekmask">
/// A seven-element array indicating which of Monday through Sunday are
/// valid days.<br></br>
/// May be specified as a length-seven list or array, like
/// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string
/// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for
/// weekdays, optionally separated by white space.<br></br>
/// Valid abbreviations
/// are: Mon Tue Wed Thu Fri Sat Sun
/// </param>
/// <param name="holidays">
/// An array of dates to consider as invalid dates.<br></br>
/// They may be
/// specified in any order, and NaT (not-a-time) dates are ignored.<br></br>
///
/// This list is saved in a normalized form that is suited for
/// fast calculations of valid days.
/// </param>
/// <param name="busdaycal">
/// A busdaycalendar object which specifies the valid days.<br></br>
/// If this
/// parameter is provided, neither weekmask nor holidays may be
/// provided.
/// </param>
/// <param name="out">
/// If provided, this array is filled with the result.
/// </param>
/// <returns>
/// An array with a shape from broadcasting dates and offsets
/// together, containing the dates with offsets applied.
/// </returns>
public array of datetime64[D] busday_offset(string[] dates, array_like of int offsets, string roll = "raise", string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, array of datetime64[D] @out = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dates,
offsets,
});
var kwargs=new PyDict();
if (roll!="raise") kwargs["roll"]=ToPython(roll);
if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask);
if (holidays!=null) kwargs["holidays"]=ToPython(holidays);
if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("busday_offset", pyargs, kwargs);
return ToCsharp<array of datetime64[D]>(py);
}
*/
/*
/// <summary>
/// Counts the number of valid days between begindates and
/// enddates, not including the day of enddates.<br></br>
///
/// If enddates specifies a date value that is earlier than the
/// corresponding begindates date value, the count will be negative.
/// </summary>
/// <param name="begindates">
/// The array of the first dates for counting.
/// </param>
/// <param name="enddates">
/// The array of the end dates for counting, which are excluded
/// from the count themselves.
/// </param>
/// <param name="weekmask">
/// A seven-element array indicating which of Monday through Sunday are
/// valid days.<br></br>
/// May be specified as a length-seven list or array, like
/// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string
/// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for
/// weekdays, optionally separated by white space.<br></br>
/// Valid abbreviations
/// are: Mon Tue Wed Thu Fri Sat Sun
/// </param>
/// <param name="holidays">
/// An array of dates to consider as invalid dates.<br></br>
/// They may be
/// specified in any order, and NaT (not-a-time) dates are ignored.<br></br>
///
/// This list is saved in a normalized form that is suited for
/// fast calculations of valid days.
/// </param>
/// <param name="busdaycal">
/// A busdaycalendar object which specifies the valid days.<br></br>
/// If this
/// parameter is provided, neither weekmask nor holidays may be
/// provided.
/// </param>
/// <param name="out">
/// If provided, this array is filled with the result.
/// </param>
/// <returns>
/// An array with a shape from broadcasting begindates and enddates
/// together, containing the number of valid days between
/// the begin and end dates.
/// </returns>
public array of int busday_count(string[] begindates, string[] enddates, string weekmask = "1111100", string[] holidays = [], busdaycalendar busdaycal = null, array of int @out = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
begindates,
enddates,
});
var kwargs=new PyDict();
if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask);
if (holidays!=[]) kwargs["holidays"]=ToPython(holidays);
if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("busday_count", pyargs, kwargs);
return ToCsharp<array of int>(py);
}
*/
}
}