flasc.flasc_dataframe.FlascDataFrame#
- class flasc.flasc_dataframe.FlascDataFrame(*args, channel_name_map=None, long_data_columns=None, **kwargs)[source]#
Bases:
DataFrame
Subclass 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
abs
Return a Series/DataFrame with absolute numeric value of each element.
add
Get Addition of dataframe and other, element-wise (binary operator add).
add_prefix
Prefix labels with string prefix.
add_suffix
Suffix labels with string suffix.
agg
Aggregate using one or more operations over the specified axis.
aggregate
Aggregate using one or more operations over the specified axis.
align
Align two objects on their axes with the specified join method.
all
Return whether all elements are True, potentially over an axis.
any
Return whether any element is True, potentially over an axis.
apply
Apply a function along an axis of the DataFrame.
applymap
Apply a function to a Dataframe elementwise.
asfreq
Convert time series to specified frequency.
asof
Return the last row(s) without any NaNs before where.
assign
Assign new columns to a DataFrame.
astype
Cast a pandas object to a specified dtype
dtype
.at_time
Select values at particular time of day (e.g., 9:30AM).
backfill
Fill NA/NaN values by using the next valid observation to fill the gap.
between_time
Select values between particular times of the day (e.g., 9:00-9:30 AM).
bfill
Fill NA/NaN values by using the next valid observation to fill the gap.
bool
Return the bool of a single element Series or DataFrame.
boxplot
Make a box plot from DataFrame columns.
Raise an error if the data is not in FLASC format.
clip
Trim values at input threshold(s).
combine
Perform column-wise combine with another DataFrame.
combine_first
Update null elements with value in the same location in other.
compare
Compare to another DataFrame and show the differences.
convert_dtypes
Convert 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.
copy
Make a copy of this object's indices and data.
Copy metadata from another FlascDataFrame to self.
corr
Compute pairwise correlation of columns, excluding NA/null values.
corrwith
Compute pairwise correlation.
count
Count non-NA cells for each column or row.
cov
Compute pairwise covariance of columns, excluding NA/null values.
cummax
Return cumulative maximum over a DataFrame or Series axis.
cummin
Return cumulative minimum over a DataFrame or Series axis.
cumprod
Return cumulative product over a DataFrame or Series axis.
cumsum
Return cumulative sum over a DataFrame or Series axis.
describe
Generate descriptive statistics.
diff
First discrete difference of element.
div
Get Floating division of dataframe and other, element-wise (binary operator truediv).
divide
Get Floating division of dataframe and other, element-wise (binary operator truediv).
dot
Compute the matrix multiplication between the DataFrame and other.
drop
Drop specified labels from rows or columns.
drop_duplicates
Return DataFrame with duplicate rows removed.
droplevel
Return Series/DataFrame with requested index / column level(s) removed.
dropna
Remove missing values.
duplicated
Return boolean Series denoting duplicate rows.
eq
Get Equal to of dataframe and other, element-wise (binary operator eq).
equals
Test whether two objects contain the same elements.
eval
Evaluate a string describing operations on DataFrame columns.
ewm
Provide exponentially weighted (EW) calculations.
expanding
Provide expanding window calculations.
explode
Transform each element of a list-like to a row, replicating index values.
Convert the DataFrame to the format that wind-up expects.
ffill
Fill NA/NaN values by propagating the last valid observation to next valid.
fillna
Fill NA/NaN values using the specified method.
filter
Subset the dataframe rows or columns according to the specified index labels.
first
Select initial periods of time series data based on a date offset.
first_valid_index
Return index for first non-NA value or None, if no non-NA value is found.
floordiv
Get Integer division of dataframe and other, element-wise (binary operator floordiv).
from_dict
Construct DataFrame from dict of array-like or dicts.
from_records
Convert structured or record ndarray to DataFrame.
ge
Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).
get
Get item from object for given key (ex: DataFrame column).
groupby
Group DataFrame using a mapper or by a Series of columns.
gt
Get Greater than of dataframe and other, element-wise (binary operator gt).
head
Return the first n rows.
hist
Make a histogram of the DataFrame's columns.
idxmax
Return index of first occurrence of maximum over requested axis.
idxmin
Return index of first occurrence of minimum over requested axis.
infer_objects
Attempt to infer better dtypes for object columns.
info
Print a concise summary of a DataFrame.
insert
Insert column into DataFrame at specified location.
interpolate
Fill NaN values using an interpolation method.
isetitem
Set the given value in the column with position loc.
isin
Whether each element in the DataFrame is contained in values.
isna
Detect missing values.
isnull
DataFrame.isnull is an alias for DataFrame.isna.
items
Iterate over (column name, Series) pairs.
iterrows
Iterate over DataFrame rows as (index, Series) pairs.
itertuples
Iterate over DataFrame rows as namedtuples.
join
Join columns of another DataFrame.
keys
Get the 'info axis' (see Indexing for more).
kurt
Return unbiased kurtosis over requested axis.
kurtosis
Return unbiased kurtosis over requested axis.
last
Select final periods of time series data based on a date offset.
last_valid_index
Return index for last non-NA value or None, if no non-NA value is found.
le
Get Less than or equal to of dataframe and other, element-wise (binary operator le).
lt
Get Less than of dataframe and other, element-wise (binary operator lt).
map
Apply a function to a Dataframe elementwise.
mask
Replace values where the condition is True.
max
Return the maximum of the values over the requested axis.
mean
Return the mean of the values over the requested axis.
median
Return the median of the values over the requested axis.
melt
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
memory_usage
Return the memory usage of each column in bytes.
merge
Merge DataFrame or named Series objects with a database-style join.
min
Return the minimum of the values over the requested axis.
mod
Get Modulo of dataframe and other, element-wise (binary operator mod).
mode
Get the mode(s) of each element along the selected axis.
mul
Get Multiplication of dataframe and other, element-wise (binary operator mul).
multiply
Get Multiplication of dataframe and other, element-wise (binary operator mul).
ne
Get Not equal to of dataframe and other, element-wise (binary operator ne).
nlargest
Return the first n rows ordered by columns in descending order.
notna
Detect existing (non-missing) values.
notnull
DataFrame.notnull is an alias for DataFrame.notna.
nsmallest
Return the first n rows ordered by columns in ascending order.
nunique
Count number of distinct elements in specified axis.
pad
Fill NA/NaN values by propagating the last valid observation to next valid.
pct_change
Fractional change between the current and a prior element.
pipe
Apply chainable functions that expect Series or DataFrames.
pivot
Return reshaped DataFrame organized by given index / column values.
pivot_table
Create a spreadsheet-style pivot table as a DataFrame.
pop
Return item and drop from frame.
pow
Get Exponential power of dataframe and other, element-wise (binary operator pow).
prod
Return the product of the values over the requested axis.
product
Return the product of the values over the requested axis.
quantile
Return values at the given quantile over requested axis.
query
Query the columns of a DataFrame with a boolean expression.
radd
Get Addition of dataframe and other, element-wise (binary operator radd).
rank
Compute numerical data ranks (1 through n) along axis.
rdiv
Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
reindex
Conform DataFrame to new index with optional filling logic.
reindex_like
Return an object with matching indices as other object.
rename
Rename columns or index labels.
rename_axis
Set the name of the axis for the index or columns.
reorder_levels
Rearrange index levels using input order.
replace
Replace values given in to_replace with value.
resample
Resample time-series data.
reset_index
Reset the index, or a level of it.
rfloordiv
Get Integer division of dataframe and other, element-wise (binary operator rfloordiv).
rmod
Get Modulo of dataframe and other, element-wise (binary operator rmod).
rmul
Get Multiplication of dataframe and other, element-wise (binary operator rmul).
rolling
Provide rolling window calculations.
round
Round a DataFrame to a variable number of decimal places.
rpow
Get Exponential power of dataframe and other, element-wise (binary operator rpow).
rsub
Get Subtraction of dataframe and other, element-wise (binary operator rsub).
rtruediv
Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
sample
Return a random sample of items from an axis of object.
select_dtypes
Return a subset of the DataFrame's columns based on the column dtypes.
sem
Return unbiased standard error of the mean over requested axis.
set_axis
Assign desired index to given axis.
set_flags
Return a new object with updated flags.
set_index
Set the DataFrame index using existing columns.
shift
Shift index by desired number of periods with an optional time freq.
skew
Return unbiased skew over requested axis.
sort_index
Sort object by labels (along an axis).
sort_values
Sort by the values along either axis.
squeeze
Squeeze 1 dimensional axis objects into scalars.
stack
Stack the prescribed level(s) from columns to index.
std
Return sample standard deviation over requested axis.
sub
Get Subtraction of dataframe and other, element-wise (binary operator sub).
subtract
Get Subtraction of dataframe and other, element-wise (binary operator sub).
sum
Return the sum of the values over the requested axis.
swapaxes
Interchange axes and swap values axes appropriately.
swaplevel
Swap levels i and j in a
MultiIndex
.tail
Return the last n rows.
take
Return the elements in the given positional indices along an axis.
to_clipboard
Copy object to the system clipboard.
to_csv
Write object to a comma-separated values (csv) file.
to_dict
Convert the DataFrame to a dictionary.
to_excel
Write object to an Excel sheet.
Raise warning about lost information and save to feather format.
to_gbq
Write a DataFrame to a Google BigQuery table.
to_hdf
Write the contained data to an HDF5 file using HDFStore.
to_html
Render a DataFrame as an HTML table.
to_json
Convert the object to a JSON string.
to_latex
Render object to a LaTeX tabular, longtable, or nested table.
to_markdown
Print DataFrame in Markdown-friendly format.
to_numpy
Convert the DataFrame to a NumPy array.
to_orc
Write a DataFrame to the ORC format.
to_parquet
Write a DataFrame to the binary parquet format.
to_period
Convert DataFrame from DatetimeIndex to PeriodIndex.
to_pickle
Pickle (serialize) object to file.
to_records
Convert DataFrame to a NumPy record array.
to_sql
Write records stored in a DataFrame to a SQL database.
to_stata
Export DataFrame object to Stata dta format.
to_string
Render a DataFrame to a console-friendly tabular output.
to_timestamp
Cast to DatetimeIndex of timestamps, at beginning of period.
to_xarray
Return an xarray object from the pandas object.
to_xml
Render a DataFrame to an XML document.
transform
Call
func
on self producing a DataFrame with the same axis shape as self.transpose
Transpose index and columns.
truediv
Get Floating division of dataframe and other, element-wise (binary operator truediv).
truncate
Truncate a Series or DataFrame before and after some index value.
tz_convert
Convert tz-aware axis to target time zone.
tz_localize
Localize tz-naive index of a Series or DataFrame to target time zone.
unstack
Pivot a level of the (necessarily hierarchical) index labels.
update
Modify in place using non-NA values from another DataFrame.
value_counts
Return a Series containing the frequency of each distinct row in the Dataframe.
var
Return unbiased variance over requested axis.
where
Replace values where the condition is False.
xs
Return cross-section from the Series/DataFrame.
Attributes
T
The transpose of the DataFrame.
at
Access a single value for a row/column label pair.
attrs
Dictionary of global attributes of this dataset.
axes
Return a list representing the axes of the DataFrame.
columns
The column labels of the DataFrame.
dtypes
Return the dtypes in the DataFrame.
empty
Indicator whether Series/DataFrame is empty.
flags
Get the properties associated with this pandas object.
iat
Access a single value for a row/column pair by integer position.
iloc
Purely integer-location based indexing for selection by position.
Return True if the data is in FLASC format, False otherwise.
index
The index (row labels) of the DataFrame.
loc
Access a group of rows and columns by label(s) or a boolean array.
Return the number of turbines in the dataset.
ndim
Return an int representing the number of axes / array dimensions.
shape
Return a tuple representing the dimensionality of the DataFrame.
size
Return an int representing the number of elements in this object.
style
Returns a Styler object.
values
Return 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)