Lean  $LEAN_TAG$
QuantConnect.Python.PandasConverter Class Reference

Collection of methods that converts lists of objects in pandas.DataFrame More...

Public Member Functions

PyObject GetDataFrame (IEnumerable< Slice > data, bool flatten=false, Type dataType=null)
 Converts an enumerable of Slice in a pandas.DataFrame More...
 
PyObject GetDataFrame< T > (IEnumerable< T > data, bool symbolOnlyIndex=false, bool forceMultiValueSymbol=false, bool flatten=false)
 Converts an enumerable of IBaseData in a pandas.DataFrame More...
 
PyObject GetIndicatorDataFrame (IEnumerable< KeyValuePair< string, List< IndicatorDataPoint >>> data)
 Converts a dictionary with a list of IndicatorDataPoint in a pandas.DataFrame More...
 
PyObject GetIndicatorDataFrame (PyObject data)
 Converts a dictionary with a list of IndicatorDataPoint in a pandas.DataFrame More...
 
override string ToString ()
 Returns a string that represent the current object More...
 

Static Public Member Functions

static PyObject ConcatDataFrames< T > (IEnumerable< PyObject > dataFrames, IEnumerable< T > keys, IEnumerable< string > names, bool sort=true, bool dropna=true)
 Concatenates multiple data frames More...
 
static PyObject ConcatDataFrames (IEnumerable< PyObject > dataFrames, bool sort=true, bool dropna=true)
 

Detailed Description

Collection of methods that converts lists of objects in pandas.DataFrame

Definition at line 30 of file PandasConverter.cs.

Member Function Documentation

◆ GetDataFrame()

PyObject QuantConnect.Python.PandasConverter.GetDataFrame ( IEnumerable< Slice data,
bool  flatten = false,
Type  dataType = null 
)

Converts an enumerable of Slice in a pandas.DataFrame

Parameters
dataEnumerable of Slice
flattenWhether to flatten collections into rows and columns
dataTypeOptional type of bars to add to the data frame If true, the base data items time will be ignored and only the base data collection time will be used in the index
Returns
PyObject containing a pandas.DataFrame

Definition at line 57 of file PandasConverter.cs.

Here is the caller graph for this function:

◆ GetDataFrame< T >()

PyObject QuantConnect.Python.PandasConverter.GetDataFrame< T > ( IEnumerable< T >  data,
bool  symbolOnlyIndex = false,
bool  forceMultiValueSymbol = false,
bool  flatten = false 
)

Converts an enumerable of IBaseData in a pandas.DataFrame

Parameters
dataEnumerable of Slice
symbolOnlyIndexWhether to make the index only the symbol, without time or any other index levels
forceMultiValueSymbolUseful when the data contains points for multiple symbols. If false and symbolOnlyIndex is true, it will assume there is a single point for each symbol, and will apply performance improvements for the data frame generation.
flattenWhether to flatten collections into rows and columns
Returns
PyObject containing a pandas.DataFrame

Helper method for testing

Type Constraints
T :ISymbolProvider 

Definition at line 74 of file PandasConverter.cs.

◆ GetIndicatorDataFrame() [1/2]

PyObject QuantConnect.Python.PandasConverter.GetIndicatorDataFrame ( IEnumerable< KeyValuePair< string, List< IndicatorDataPoint >>>  data)

Converts a dictionary with a list of IndicatorDataPoint in a pandas.DataFrame

Parameters
dataDictionary with a list of IndicatorDataPoint
Returns
PyObject containing a pandas.DataFrame

Definition at line 91 of file PandasConverter.cs.

◆ GetIndicatorDataFrame() [2/2]

PyObject QuantConnect.Python.PandasConverter.GetIndicatorDataFrame ( PyObject  data)

Converts a dictionary with a list of IndicatorDataPoint in a pandas.DataFrame

Parameters
dataPyObject that should be a dictionary (convertible to PyDict) of string to list of IndicatorDataPoint
Returns
PyObject containing a pandas.DataFrame

Definition at line 111 of file PandasConverter.cs.

Here is the call graph for this function:

◆ ToString()

override string QuantConnect.Python.PandasConverter.ToString ( )

Returns a string that represent the current object

Returns

Definition at line 151 of file PandasConverter.cs.

◆ ConcatDataFrames< T >()

static PyObject QuantConnect.Python.PandasConverter.ConcatDataFrames< T > ( IEnumerable< PyObject >  dataFrames,
IEnumerable< T >  keys,
IEnumerable< string >  names,
bool  sort = true,
bool  dropna = true 
)
static

Concatenates multiple data frames

Parameters
dataFramesThe data frames to concatenate
keysOptional new keys for a new multi-index level that would be added to index each individual data frame in the resulting one
namesThe optional names of the new index level (and the existing ones if they need to be changed)
sortWhether to sort the resulting data frame
dropnaWhether to drop columns containing NA values only (Nan, None, etc)
Returns
A new data frame result from concatenating the input

Definition at line 176 of file PandasConverter.cs.


The documentation for this class was generated from the following file: