mbmackenzie / tidybear Goto Github PK
View Code? Open in Web Editor NEWA tidier approach to pandas.
License: MIT License
A tidier approach to pandas.
License: MIT License
Should be if decimals is None
instead is if decimals
in
Line 193 in 0e38bd4
Some tidy selectors do no work on column names that are numeric because internally they use string methods.
A tidy selector should convert names to strings in cases where string methods are used apply the filters and convert them back.
import pandas as pd
import tidybear as tb
from tidybear.selectors import starts_with
data = pd.DataFrame(
{
"THING": ["A", "A", "B", "B"],
"YEAR": [2021, 2022, 2021, 2022],
"VALUE": [1, 2, 3, 4],
}
)
tmp = tb.pivot_wider(data, names_from="YEAR", values_from="VALUE")
tb.pivot_longer(tmp, starts_with("20"), names_to="YEAR", values_to="VALUE")
156 def selector(columns: Iterable[str]) -> List[str]:
--> 157 return [c for c in columns if c.startswith(pattern)]
AttributeError: 'int' object has no attribute 'startswith'
THING YEAR VALUE
0 A 2021 1
1 A 2022 2
2 B 2021 3
3 B 2022 4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.