Comments (2)
@jforbess, this may not be the easiest solution, but you can manually edit the translation dictionary attribute (CapData.trans
) to change the list of column names assigned to each category key or to add new category keys. The __set_trans()
method also sets the CapData.trans_keys
attribute and calls CapData.set_plot_attributes
, so you may might run into issues related to those attributes not matching your adjustments to CapData.trans
. Running CapData__set_trans()
after your manual adjustments to CapData.trans
may fix those issues.
The other option, which should be more reliable, is to make adjustments to the category dictionaries used to generate the CapData.trans
keys and assign columns to them. These are capdata.type_defs
, capdata.sub_type_defs
, and capdata.irr_sensor_defs
. These are ordered dictionaries and can be modified so you get a more useful translation dictionary. If you have repeated search strings in the lists across different categories, you will get unexpected results.
For example, the first two categories in the default sub_type_defs
are
sub_type_defs = collections.OrderedDict([
('ghi', [['sun2', 'global horizontal', 'ghi', 'global',
'GlobHor']]),
('poa', [['sun', 'plane of array', 'poa', 'GlobInc']]),
If you add 'poa_global'
to the list paired with 'poa'
, the column with that string in it will still be assigned to the 'ghi'
category because __series_type()
will attempt to assign the 'ghi'
category first and it will find 'global' within 'poa_global'.
#18 and #20 are also related to this issue. The idea in #18 is to add some helper functions that could be passed to the pandas dataframe rename method. I am thinking that would help with this issue quite a bit.
from pvcaptest.
Closing, after v0.11 refactor. As of v0.11 you can pass a path to a file (json, yaml, or xlsx) explicitly defining the column grouping or a function to group to the group_columns attribute of the load_data
function, which is now available from captest.load_data
or io.load_data
.
An easy workflow to define an explicit column grouping in an excel file is to run load_data twice, first with column_groups_template
set to True
, which will save out an excel file of sorted (doesn't always sort perfectly) column names. Then you can add whatever column group ids you want, and re-run load_data
passing that excel file to group_columns
.
from pvcaptest.
Related Issues (20)
- Export Filtered Datasets HOT 1
- Scipy version in yaml HOT 2
- load_pvsyst requires pandas<1.3.0 HOT 1
- CapData.copy should use deepcopy on column_groups attribute
- SVG version of logo HOT 2
- `tables` is not needed for `pvlib>=0.9.0` HOT 1
- Migrate CI from Travis to Github Actions HOT 3
- io.load_data kwargs docstring incorrect
- `DataLoader.load` doesn't pass kwargs to `file_reader` when path is to a file HOT 1
- `io.file_reader` should allow passing kwargs used in `read_csv`
- clean up io.DataLoader.load docstring
- remove references in docstrings to irr_rc_balanced
- Getting "invalid index to scalar variable" when loading data HOT 22
- Setup Zenodo to create DOI for releases? GH release process? HOT 7
- DataLoader.load try except obscuring errors
- Error when using a tolerance value with a decimal
- Holoviews import error when trying to import captest HOT 2
- Bokeh Plotting Issue HOT 7
- New plot() -- default_groups created in Layout tab is causing an error when data tag names have changed HOT 4
- Custom plot using plots_defaults.json fails doesn't work with more than one CapData object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pvcaptest.