flasc.flasc_dataframe.FlascDataFrame#
- class flasc.flasc_dataframe.FlascDataFrame(*args, channel_name_map=None, long_data_columns=None, **kwargs)[source]#
Bases:
DataFrameSubclass of pandas.DataFrame for working with FLASC data.
Stores data in preferred Flasc format, or user format, with option to convert between the two.
Want handling to go between long and wide.
Methods
absReturn a Series/DataFrame with absolute numeric value of each element.
addGet Addition of dataframe and other, element-wise (binary operator add).
add_prefixPrefix labels with string prefix.
add_suffixSuffix labels with string suffix.
aggAggregate using one or more operations over the specified axis.
aggregateAggregate using one or more operations over the specified axis.
alignAlign two objects on their axes with the specified join method.
allReturn whether all elements are True, potentially over an axis.
anyReturn whether any element is True, potentially over an axis.
applyApply a function along an axis of the DataFrame.
applymapApply a function to a Dataframe elementwise.
asfreqConvert time series to specified frequency.
asofReturn the last row(s) without any NaNs before where.
assignAssign new columns to a DataFrame.
astypeCast a pandas object to a specified dtype
dtype.at_timeSelect values at particular time of day (e.g., 9:30AM).
backfillFill NA/NaN values by using the next valid observation to fill the gap.
between_timeSelect values between particular times of the day (e.g., 9:00-9:30 AM).
bfillFill NA/NaN values by using the next valid observation to fill the gap.
boolReturn the bool of a single element Series or DataFrame.
boxplotMake a box plot from DataFrame columns.
Raise an error if the data is not in FLASC format.
clipTrim values at input threshold(s).
combinePerform column-wise combine with another DataFrame.
combine_firstUpdate null elements with value in the same location in other.
compareCompare to another DataFrame and show the differences.
convert_dtypesConvert columns to the best possible dtypes using dtypes supporting
pd.NA.Convert the time column to a datetime representation.
Convert the DataFrame to the format that FLASC expects.
Convert the DataFrame to the format that the user expects, given the channel_name_map.
copyMake a copy of this object's indices and data.
Copy metadata from another FlascDataFrame to self.
corrCompute pairwise correlation of columns, excluding NA/null values.
corrwithCompute pairwise correlation.
countCount non-NA cells for each column or row.
covCompute pairwise covariance of columns, excluding NA/null values.
cummaxReturn cumulative maximum over a DataFrame or Series axis.
cumminReturn cumulative minimum over a DataFrame or Series axis.
cumprodReturn cumulative product over a DataFrame or Series axis.
cumsumReturn cumulative sum over a DataFrame or Series axis.
describeGenerate descriptive statistics.
diffFirst discrete difference of element.
divGet Floating division of dataframe and other, element-wise (binary operator truediv).
divideGet Floating division of dataframe and other, element-wise (binary operator truediv).
dotCompute the matrix multiplication between the DataFrame and other.
dropDrop specified labels from rows or columns.
drop_duplicatesReturn DataFrame with duplicate rows removed.
droplevelReturn Series/DataFrame with requested index / column level(s) removed.
dropnaRemove missing values.
duplicatedReturn boolean Series denoting duplicate rows.
eqGet Equal to of dataframe and other, element-wise (binary operator eq).
equalsTest whether two objects contain the same elements.
evalEvaluate a string describing operations on DataFrame columns.
ewmProvide exponentially weighted (EW) calculations.
expandingProvide expanding window calculations.
explodeTransform each element of a list-like to a row, replicating index values.
Convert the DataFrame to the format that wind-up expects.
ffillFill NA/NaN values by propagating the last valid observation to next valid.
fillnaFill NA/NaN values using the specified method.
filterSubset the dataframe rows or columns according to the specified index labels.
firstSelect initial periods of time series data based on a date offset.
first_valid_indexReturn index for first non-NA value or None, if no non-NA value is found.
floordivGet Integer division of dataframe and other, element-wise (binary operator floordiv).
from_dictConstruct DataFrame from dict of array-like or dicts.
from_recordsConvert structured or record ndarray to DataFrame.
geGet Greater than or equal to of dataframe and other, element-wise (binary operator ge).
getGet item from object for given key (ex: DataFrame column).
groupbyGroup DataFrame using a mapper or by a Series of columns.
gtGet Greater than of dataframe and other, element-wise (binary operator gt).
headReturn the first n rows.
histMake a histogram of the DataFrame's columns.
idxmaxReturn index of first occurrence of maximum over requested axis.
idxminReturn index of first occurrence of minimum over requested axis.
infer_objectsAttempt to infer better dtypes for object columns.
infoPrint a concise summary of a DataFrame.
insertInsert column into DataFrame at specified location.
interpolateFill NaN values using an interpolation method.
isetitemSet the given value in the column with position loc.
isinWhether each element in the DataFrame is contained in values.
isnaDetect missing values.
isnullDataFrame.isnull is an alias for DataFrame.isna.
itemsIterate over (column name, Series) pairs.
iterrowsIterate over DataFrame rows as (index, Series) pairs.
itertuplesIterate over DataFrame rows as namedtuples.
joinJoin columns of another DataFrame.
keysGet the 'info axis' (see Indexing for more).
kurtReturn unbiased kurtosis over requested axis.
kurtosisReturn unbiased kurtosis over requested axis.
lastSelect final periods of time series data based on a date offset.
last_valid_indexReturn index for last non-NA value or None, if no non-NA value is found.
leGet Less than or equal to of dataframe and other, element-wise (binary operator le).
ltGet Less than of dataframe and other, element-wise (binary operator lt).
mapApply a function to a Dataframe elementwise.
maskReplace values where the condition is True.
maxReturn the maximum of the values over the requested axis.
meanReturn the mean of the values over the requested axis.
medianReturn the median of the values over the requested axis.
meltUnpivot a DataFrame from wide to long format, optionally leaving identifiers set.
memory_usageReturn the memory usage of each column in bytes.
mergeMerge DataFrame or named Series objects with a database-style join.
minReturn the minimum of the values over the requested axis.
modGet Modulo of dataframe and other, element-wise (binary operator mod).
modeGet the mode(s) of each element along the selected axis.
mulGet Multiplication of dataframe and other, element-wise (binary operator mul).
multiplyGet Multiplication of dataframe and other, element-wise (binary operator mul).
neGet Not equal to of dataframe and other, element-wise (binary operator ne).
nlargestReturn the first n rows ordered by columns in descending order.
notnaDetect existing (non-missing) values.
notnullDataFrame.notnull is an alias for DataFrame.notna.
nsmallestReturn the first n rows ordered by columns in ascending order.
nuniqueCount number of distinct elements in specified axis.
padFill NA/NaN values by propagating the last valid observation to next valid.
pct_changeFractional change between the current and a prior element.
pipeApply chainable functions that expect Series or DataFrames.
pivotReturn reshaped DataFrame organized by given index / column values.
pivot_tableCreate a spreadsheet-style pivot table as a DataFrame.
popReturn item and drop from frame.
powGet Exponential power of dataframe and other, element-wise (binary operator pow).
prodReturn the product of the values over the requested axis.
productReturn the product of the values over the requested axis.
quantileReturn values at the given quantile over requested axis.
queryQuery the columns of a DataFrame with a boolean expression.
raddGet Addition of dataframe and other, element-wise (binary operator radd).
rankCompute numerical data ranks (1 through n) along axis.
rdivGet Floating division of dataframe and other, element-wise (binary operator rtruediv).
reindexConform DataFrame to new index with optional filling logic.
reindex_likeReturn an object with matching indices as other object.
renameRename columns or index labels.
rename_axisSet the name of the axis for the index or columns.
reorder_levelsRearrange index levels using input order.
replaceReplace values given in to_replace with value.
resampleResample time-series data.
reset_indexReset the index, or a level of it.
rfloordivGet Integer division of dataframe and other, element-wise (binary operator rfloordiv).
rmodGet Modulo of dataframe and other, element-wise (binary operator rmod).
rmulGet Multiplication of dataframe and other, element-wise (binary operator rmul).
rollingProvide rolling window calculations.
roundRound a DataFrame to a variable number of decimal places.
rpowGet Exponential power of dataframe and other, element-wise (binary operator rpow).
rsubGet Subtraction of dataframe and other, element-wise (binary operator rsub).
rtruedivGet Floating division of dataframe and other, element-wise (binary operator rtruediv).
sampleReturn a random sample of items from an axis of object.
select_dtypesReturn a subset of the DataFrame's columns based on the column dtypes.
semReturn unbiased standard error of the mean over requested axis.
set_axisAssign desired index to given axis.
set_flagsReturn a new object with updated flags.
set_indexSet the DataFrame index using existing columns.
shiftShift index by desired number of periods with an optional time freq.
skewReturn unbiased skew over requested axis.
sort_indexSort object by labels (along an axis).
sort_valuesSort by the values along either axis.
squeezeSqueeze 1 dimensional axis objects into scalars.
stackStack the prescribed level(s) from columns to index.
stdReturn sample standard deviation over requested axis.
subGet Subtraction of dataframe and other, element-wise (binary operator sub).
subtractGet Subtraction of dataframe and other, element-wise (binary operator sub).
sumReturn the sum of the values over the requested axis.
swapaxesInterchange axes and swap values axes appropriately.
swaplevelSwap levels i and j in a
MultiIndex.tailReturn the last n rows.
takeReturn the elements in the given positional indices along an axis.
to_clipboardCopy object to the system clipboard.
to_csvWrite object to a comma-separated values (csv) file.
to_dictConvert the DataFrame to a dictionary.
to_excelWrite object to an Excel sheet.
Raise warning about lost information and save to feather format.
to_gbqWrite a DataFrame to a Google BigQuery table.
to_hdfWrite the contained data to an HDF5 file using HDFStore.
to_htmlRender a DataFrame as an HTML table.
to_jsonConvert the object to a JSON string.
to_latexRender object to a LaTeX tabular, longtable, or nested table.
to_markdownPrint DataFrame in Markdown-friendly format.
to_numpyConvert the DataFrame to a NumPy array.
to_orcWrite a DataFrame to the ORC format.
to_parquetWrite a DataFrame to the binary parquet format.
to_periodConvert DataFrame from DatetimeIndex to PeriodIndex.
to_picklePickle (serialize) object to file.
to_recordsConvert DataFrame to a NumPy record array.
to_sqlWrite records stored in a DataFrame to a SQL database.
to_stataExport DataFrame object to Stata dta format.
to_stringRender a DataFrame to a console-friendly tabular output.
to_timestampCast to DatetimeIndex of timestamps, at beginning of period.
to_xarrayReturn an xarray object from the pandas object.
to_xmlRender a DataFrame to an XML document.
transformCall
funcon self producing a DataFrame with the same axis shape as self.transposeTranspose index and columns.
truedivGet Floating division of dataframe and other, element-wise (binary operator truediv).
truncateTruncate a Series or DataFrame before and after some index value.
tz_convertConvert tz-aware axis to target time zone.
tz_localizeLocalize tz-naive index of a Series or DataFrame to target time zone.
unstackPivot a level of the (necessarily hierarchical) index labels.
updateModify in place using non-NA values from another DataFrame.
value_countsReturn a Series containing the frequency of each distinct row in the Dataframe.
varReturn unbiased variance over requested axis.
whereReplace values where the condition is False.
xsReturn cross-section from the Series/DataFrame.
Attributes
TThe transpose of the DataFrame.
atAccess a single value for a row/column label pair.
attrsDictionary of global attributes of this dataset.
axesReturn a list representing the axes of the DataFrame.
columnsThe column labels of the DataFrame.
dtypesReturn the dtypes in the DataFrame.
emptyIndicator whether Series/DataFrame is empty.
flagsGet the properties associated with this pandas object.
iatAccess a single value for a row/column pair by integer position.
ilocPurely integer-location based indexing for selection by position.
Return True if the data is in FLASC format, False otherwise.
indexThe index (row labels) of the DataFrame.
locAccess a group of rows and columns by label(s) or a boolean array.
Return the number of turbines in the dataset.
ndimReturn an int representing the number of axes / array dimensions.
shapeReturn a tuple representing the dimensionality of the DataFrame.
sizeReturn an int representing the number of elements in this object.
styleReturns a Styler object.
valuesReturn a Numpy representation of the DataFrame.
- _metadata: list[str] = ['channel_name_map', '_user_format', '_long_data_columns']#
- property in_flasc_format#
Return True if the data is in FLASC format, False otherwise.
- property _constructor#
Used when a manipulation result has the same dimensions as the original.
- property n_turbines#
Return the number of turbines in the dataset.
- copy_metadata(other)[source]#
Copy metadata from another FlascDataFrame to self.
- Parameters:
other (FlascDataFrame) -- DataFrame to copy metadata from.
- convert_to_user_format(inplace=False)[source]#
Convert the DataFrame to the format that the user expects, given the channel_name_map.
- Parameters:
inplace (bool) -- If True, modify the DataFrame in place. If False, return a new DataFrame.
- Returns:
FlascDataFrame in user format if inplace is False, None otherwise.
- Return type:
- convert_time_to_datetime(inplace=False)[source]#
Convert the time column to a datetime representation.
- Parameters:
inplace (bool) -- If True, modify the DataFrame in place. If False, return a new DataFrame.
- Returns:
FlascDataFrame with time column as datetime object if inplace is False, None otherwise
- Return type:
- convert_to_flasc_format(inplace=False)[source]#
Convert the DataFrame to the format that FLASC expects.
- Parameters:
inplace (bool) -- If True, modify the DataFrame in place. If False, return a new DataFrame.
- Returns:
FlascDataFrame in FLASC format if inplace is False, None otherwise
- Return type:
# TODO: could consider converting "time" to datetime type here. If so, will want to keep # the original "time" column for back-conversion if needed. # Similarly, we could sort on time, but perhaps both are too meddlesome
- _convert_long_to_wide(df_)[source]#
Convert a long format DataFrame to a wide format DataFrame.
- Parameters:
df (FlascDataFrame) -- Long format FlascDataFrame
- Returns:
Wide format FlascDataFrame
- Return type:
- _convert_wide_to_long(df_)[source]#
Convert a wide format DataFrame to a long format DataFrame.
- Parameters:
df (FlascDataFrame) -- Wide format FlascDataFrame
- Returns:
Long format FlascDataFrame
- Return type:
- to_feather(path, **kwargs)[source]#
Raise warning about lost information and save to feather format.
- _mgr: BlockManager | ArrayManager#
- _attrs: dict[Hashable, Any]#
- _cache: dict[str, Any]#
- export_to_windup_format(turbine_names: list[str] | None = None, time_col: str = 'time', power_col: str = 'pow', windspeed_col: str = 'ws', winddirection_col: str = 'wd', normal_operation_col: str | None = None, pitchangle_col: str | None = None, genrpm_col: str | None = None, downtimecounter_col: str | None = None, turbine_num_digits: int = 3)[source]#
Convert the DataFrame to the format that wind-up expects.
- Parameters:
turbine_names (list[str] | None)
time_col (str)
power_col (str)
windspeed_col (str)
winddirection_col (str)
normal_operation_col (str | None)
pitchangle_col (str | None)
genrpm_col (str | None)
downtimecounter_col (str | None)
turbine_num_digits (int)