https://github.com/static-frame/frame-fixtures
Use compact expressions to create diverse, deterministic DataFrame fixtures with StaticFrame
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Keywords
dataframe
python
staticframe
testing
Last synced: 5 months ago
·
JSON representation
Repository
Use compact expressions to create diverse, deterministic DataFrame fixtures with StaticFrame
Basic Info
Statistics
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 4
- Releases: 1
Topics
dataframe
python
staticframe
testing
Created over 5 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
License
README.rst
.. image:: https://img.shields.io/pypi/pyversions/frame-fixtures.svg
:target: https://pypi.org/project/frame-fixtures
.. image:: https://img.shields.io/pypi/v/frame-fixtures.svg
:target: https://pypi.org/project/frame-fixtures
.. image:: https://img.shields.io/codecov/c/github/static-frame/frame-fixtures.svg
:target: https://codecov.io/gh/static-frame/frame-fixtures
.. image:: https://img.shields.io/github/actions/workflow/status/static-frame/frame-fixtures/ci.yml?branch=main&label=ci&logo=Github
:target: https://github.com/static-frame/frame-fixtures/actions/workflows/ci.yml
frame-fixtures
===============
The FrameFixtures library defines a tiny domain-specific language that permits using compact expressions to create diverse, deterministic DataFrame fixtures with StaticFrame. The resulting ``Frame`` can be used for test, performance studies, or documentation examples, and can easily be converted to Pandas DataFrames or other representations available via StaticFrame.
Code: https://github.com/static-frame/frame-fixtures
Packages: https://pypi.org/project/frame-fixtures
Installation
-------------------------------
Install FrameFixtures via PIP::
pip install frame-fixtures [extras]
The ``[extras]`` configuration includes StaticFrame as a requirement. As StaticFrame uses FrameFixtures, installation without ``[extras]`` assumes the availability of StaticFrame::
pip install frame-fixtures
Examples
------------------------------
Import FrameFixtures with the following convention:
>>> import frame_fixtures as ff
Create a 4 by 8 ``Frame`` of string, Booleans, and floats.
>>> ff.parse('v(str,str,bool,float)|s(4,8)')
0 1 2 3 4 5 6 7
0 zjZQ zaji True 1080.4 zDVQ zEdH True 647.9
1 zO5l zJnC False 2580.34 z5hI zB7E True 2755.18
2 zEdH zDdR False 700.42 zyT8 zwIp False -1259.28
3 zB7E zuVU True 3338.48 zS6w zDVQ False 3442.84
< < < <
The same ``Frame`` can be converted to Pandas:
>>> ff.parse('v(str,str,bool,float)|s(4,8)').to_pandas()
0 1 2 3 4 5 6 7
0 zjZQ zaji True 1080.40 zDVQ zEdH True 647.90
1 zO5l zJnC False 2580.34 z5hI zB7E True 2755.18
2 zEdH zDdR False 700.42 zyT8 zwIp False -1259.28
3 zB7E zuVU True 3338.48 zS6w zDVQ False 3442.84
Create a 4 by 4 ``Frame`` of Booleans with three-level index and columns.
>>> ff.parse('v(bool)|i(IH,(str,int,str))|c(IH,(str,int,str))|s(4,4)')
zZbu zZbu zZbu zZbu <
105269 105269 119909 119909
zDVQ z5hI zyT8 zS6w <
zZbu 105269 zDVQ False False True False
zZbu 105269 z5hI False False False False
zZbu 119909 zyT8 False False False True
zZbu 119909 zS6w True False True True
< <
The same ``Frame`` can be converted to Pandas:
>>> ff.parse('v(bool)|i(IH,(str,int,str))|c(IH,(str,int,str))|s(4,4)').to_pandas()
__index0__ zZbu
__index1__ 105269 119909
__index2__ zDVQ z5hI zyT8 zS6w
__index0__ __index1__ __index2__
zZbu 105269 zDVQ False False True False
z5hI False False False False
119909 zyT8 False False False True
zS6w True False True True
FrameFixtures support defining features unique to StaticFrame, such as specifying a grow-only ``FrameGO``, ``Index`` types within ``IndexHierarchy``, and usage of ``np.datetime64`` types other than nanoseconds. These specifications are not directly convertible to Pandas.
>>> ff.parse('f(Fg)|v(int,bool,str)|i((IY,ID),(dtY,dtD))|c(ISg,dts)|s(6,2)')
1970-01-01T09:38:35 1970-01-01T01:00:48
36685 2258-03-21 -88017 False
36685 2298-04-20 92867 False
5618 2501-10-08 84967 False
5618 2441-04-14 13448 False
93271 2234-04-07 175579 False
93271 2210-12-26 58768 False
What is New in FramFixtures
------------------------------
1.1.0
............
Now compatible with NumPy 2.0.
1.0.0
............
Updated case of ``Index`` ``datetime64`` identifiers to use standard case; ``IS``, for example, is ``Is``.
Grammar
------------------------------
Container Components
.............................
A FrameFixture is defined by specifying one or more container components using symbols such as ``s`` for shape and ``i`` for index. Container components (CCs) are given arguments using Python function call syntax, and multiple CCs are delimited with ``|``. The shape CC takes integers as arguments; all other CCs take Constructor Specifiers (CS) and/or Dtype Specifiers (DS) as arguments. So a 100 by 20 ``Frame`` with an index of ``str`` is specified as ``s(100,20)|i(I,str)``, where 100 and 20 define the row and column counts, and `I` is the CC and `str` is the DS. Component symbols, whether components are required, and the number of required arguments, is summarized below.
+-------+----------+---------+----------+----------------------------------+
|Symbol |Component |Required |Arguments |Signature |
+=======+==========+=========+==========+==================================+
|f |Frame |False |1 |(CS,) |
+-------+----------+---------+----------+----------------------------------+
|i |Index |False |2 |(CS, DS) or ((CS, ...), (DS, ...))|
+-------+----------+---------+----------+----------------------------------+
|c |Columns |False |2 |(CS, DS) or ((CS, ...), (DS, ...))|
+-------+----------+---------+----------+----------------------------------+
|v |Values |False |unbound |(DS, ...) |
+-------+----------+---------+----------+----------------------------------+
|s |Shape |True |2 |(int, int) |
+-------+----------+---------+----------+----------------------------------+
Constructor Specifiers
.............................
CSs are given to the ``f`` CC; the ``i`` and ``c`` CC take one or many CSs as their first argument.
+-------+---------------------------+
|Symbol |Class |
+=======+===========================+
|F |Frame |
+-------+---------------------------+
|Fg |FrameGO |
+-------+---------------------------+
|I |Index |
+-------+---------------------------+
|Ig |IndexGO |
+-------+---------------------------+
|IH |IndexHierarchy |
+-------+---------------------------+
|IHg |IndexHierarchyGO |
+-------+---------------------------+
|IACF |IndexAutoConstructorFactory|
+-------+---------------------------+
|IY |IndexYear |
+-------+---------------------------+
|IYg |IndexYearGO |
+-------+---------------------------+
|IM |IndexYearMonth |
+-------+---------------------------+
|IMg |IndexYearMonthGO |
+-------+---------------------------+
|IYM |IndexYearMonth |
+-------+---------------------------+
|IYMg |IndexYearMonthGO |
+-------+---------------------------+
|ID |IndexDate |
+-------+---------------------------+
|IDg |IndexDateGO |
+-------+---------------------------+
|Ih |IndexHour |
+-------+---------------------------+
|Ihg |IndexHourGO |
+-------+---------------------------+
|Im |IndexMinute |
+-------+---------------------------+
|Img |IndexMinuteGO |
+-------+---------------------------+
|Is |IndexSecond |
+-------+---------------------------+
|Isg |IndexSecondGO |
+-------+---------------------------+
|Ims |IndexMillisecond |
+-------+---------------------------+
|Imsg |IndexMillisecondGO |
+-------+---------------------------+
|Ius |IndexMicrosecond |
+-------+---------------------------+
|Iusg |IndexMicrosecondGO |
+-------+---------------------------+
|Ins |IndexNanosecond |
+-------+---------------------------+
|Insg |IndexNanosecondGO |
+-------+---------------------------+
Dtype Specifiers
.............................
DSs are given to the ``v`` CC, and are used repeatedly to fill all columns; the ``i`` and ``c`` CC take one or many DSs as their second argument.
+-----------+--------------------------+
|Symbol |Class |
+===========+==========================+
|dtY |dtype(' |
+-----------+--------------------------+
|str | |
+-----------+--------------------------+
|bytes | |
+-----------+--------------------------+
|float | |
+-----------+--------------------------+
|bool | |
+-----------+--------------------------+
|complex | |
+-----------+--------------------------+
|object | |
+-----------+--------------------------+
|int8 | |
+-----------+--------------------------+
|int16 | |
+-----------+--------------------------+
|int32 | |
+-----------+--------------------------+
|int64 | |
+-----------+--------------------------+
|uint8 | |
+-----------+--------------------------+
|uint16 | |
+-----------+--------------------------+
|uint32 | |
+-----------+--------------------------+
|uint64 | |
+-----------+--------------------------+
|float16 | |
+-----------+--------------------------+
|float32 | |
+-----------+--------------------------+
|float64 | |
+-----------+--------------------------+
|complex64 | |
+-----------+--------------------------+
|complex128 ||
+-----------+--------------------------+
Owner
- Name: static-frame
- Login: static-frame
- Kind: organization
- Repositories: 14
- Profile: https://github.com/static-frame
GitHub Events
Total
- Issues event: 1
Last Year
- Issues event: 1
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 79
- Total Committers: 2
- Avg Commits per committer: 39.5
- Development Distribution Score (DDS): 0.025
Top Committers
| Name | Commits | |
|---|---|---|
| Christopher Ariza | a****a@f****m | 77 |
| Christopher Ariza | f****e@u****m | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 9
- Total pull requests: 4
- Average time to close issues: 2 months
- Average time to close pull requests: 1 day
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 1.11
- Average comments per pull request: 0.75
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 2
- Average time to close issues: about 5 hours
- Average time to close pull requests: about 2 hours
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.5
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- flexatone (5)
- ForeverWintr (2)
- michaeljpeters (1)
Pull Request Authors
- flexatone (5)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 9,897 last-month
- Total dependent packages: 0
- Total dependent repositories: 3
- Total versions: 9
- Total maintainers: 2
pypi.org: frame-fixtures
Use compact expressions to create diverse, deterministic DataFrame fixtures with StaticFrame
- Homepage: https://github.com/static-frame/frame-fixtures
- Documentation: https://frame-fixtures.readthedocs.io/
- License: MIT
-
Latest release: 1.1.0
published over 1 year ago
Rankings
Downloads: 7.8%
Dependent repos count: 9.0%
Dependent packages count: 10.1%
Average: 15.4%
Stargazers count: 20.3%
Forks count: 29.8%
Maintainers (2)
Last synced:
6 months ago
Dependencies
requirements-extras.txt
pypi
- static-frame >=0.6.0
requirements.txt
pypi
- numpy >=1.17.4
.github/workflows/ci.yml
actions
- actions/cache v3 composite
- actions/checkout master composite
- actions/download-artifact v3 composite
- actions/setup-python master composite
- actions/upload-artifact v3 composite
- codecov/codecov-action v3 composite
- pypa/gh-action-pypi-publish master composite
requirements-dev-3_11.txt
pypi
- invoke ==2.2.0 development
- mypy ==1.10.1 development
- numpy ==1.26.4 development
- pylint ==3.2.5 development
- pytest ==8.2.2 development
- pytest-cov ==4.0.0 development
- static-frame ==2.9.0 development
- wheel ==0.42.0 development
requirements-test-3_11-np2.txt
pypi
- invoke ==2.2.0 test
- numpy ==2.0.0 test
- pytest ==8.2.2 test
- pytest-cov ==4.0.0 test
- static-frame ==2.10.0 test
requirements-test-3_11.txt
pypi
- invoke ==2.2.0 test
- numpy ==1.26.4 test
- pytest ==8.2.2 test
- pytest-cov ==4.0.0 test
- static-frame ==2.9.0 test
setup.py
pypi