19 using System.Collections.Generic;
29 private static readonly IEnumerable<string> _flattenedDfIndexNames =
new[] {
"canonical",
"symbol" };
31 private readonly Lazy<PyObject> _dataframe;
32 private readonly
bool _flatten;
46 : this(default, flatten)
57 _dataframe =
new Lazy<PyObject>(InitializeDataFrame, isThreadSafe:
false);
73 public new OptionChain this[
string ticker] {
get {
return base[ticker]; }
set { base[ticker] = value; } }
83 public new OptionChain this[
Symbol symbol] {
get {
return base[symbol]; }
set { base[symbol] = value; } }
85 private PyObject InitializeDataFrame()
87 if (!PythonEngine.IsInitialized)
92 var dataFrames = this.Select(kvp => kvp.Value.DataFrame).ToList();
96 var canonicalSymbols = this.Select(kvp => kvp.Key);
97 return PandasConverter.ConcatDataFrames(dataFrames, keys: canonicalSymbols, names: _flattenedDfIndexNames, sort:
false);