Comments (6)
The previous stubs were installed on top of the pandas installation, so you had to have pandas
installed. Now pandas-stubs
is installed as a separate package which is separate from the pandas
installation.
With respect to matplotlib
, the stubs import matplotlib
, so it's not clear that they would work without matplotlib
installed.
The purpose of these stubs is to sit alongside pandas
. I think you have to include the dependencies, but if you can prove they would work without pandas
or matplotlib
installed, then we could make a change.
from pandas-stubs.
With respect to
matplotlib
, the stubs importmatplotlib
, so it's not clear that they would work withoutmatplotlib
installed.
Most of matplotlib is not annotated. I think the matplotlib type used the most is Axes
which unfortunately resolves to Any
.
from matplotlib.axes import Axes
reveal_type(Axes) # mypy: any, pyright: Unknown
If the goal of pandas-stubs is to eventually be part of typeshed and be recommeneded by mypy, I think pandas-stubs cannot depend on any actual code (and only contain pyi files).
Should probably keep matplotlib at least on the CI: pyright would otherwise complain that it cannot find all the matplotlib imports (and matplotlib might add annotations in the future).
from pandas-stubs.
Most of matplotlib is not annotated. I think the matplotlib type used the most is
Axes
which unfortunately resolves toAny
.
matplotlib
does have annotations that are shipped with VS Code.
from matplotlib.axes import Axes reveal_type(Axes) # mypy: any, pyright: Unknown
In the above example, within VS Code, you will get Type[Axes]
on the reveal_type()
If the goal of pandas-stubs is to eventually be part of typeshed and be recommeneded by mypy, I think pandas-stubs cannot depend on any actual code (and only contain pyi files).
I'm not sure that the goal is to make pandas-stubs
part of typeshed
, although I could see that happening in the future.
from pandas-stubs.
matplotlib does have annotations that are shipped with VS Code.
Thank you, I didn't know that! If they have a standalone stub package, pandas-stubs (and pandas) should install that at least for the CI. mypy&pyright infer Axes on the pandas CI as Any/Unknown.
from pandas-stubs.
matplotlib does have annotations that are shipped with VS Code.
Thank you, I didn't know that! If they have a standalone stub package, pandas-stubs (and pandas) should install that at least for the CI. mypy&pyright infer Axes on the pandas CI as Any/Unknown.
To clarify, the matplotlib
annotations are maintained by Microsoft in https://github.com/microsoft/python-type-stubs, and then Microsoft merges those stubs into the VS Code distribution.
from pandas-stubs.
closed via #66
from pandas-stubs.
Related Issues (20)
- Stack method - Unexpected keyword argument HOT 2
- Allow 'integer' in select_dtypes include argument HOT 1
- Unexpected, Misleading mypy Failures After pandas-stubs Update: DataFrame.from_dict() Behavior HOT 5
- Should from_dict be annotated to allow sequence data values? HOT 8
- Index.rename() should return Self HOT 3
- Annotation of `get_loc` does no longer fit to `iloc` resulting in many false positive type errors. HOT 2
- Can't pass `dict` to `DataFrame.apply` HOT 1
- `Series.map()` needs type for `arg` and result HOT 5
- pd.notna does not work with pyright strict mode. HOT 1
- `df.merge` partially unknown.
- `Series.astype` is partially unknown. HOT 2
- `df.drop` signature does not capture all constraints HOT 1
- Type of "apply" is partially unknown HOT 6
- Switch `to_timedelta` argument type from `list` to `Sequence` HOT 1
- Invalid typing for `df.to_csv` HOT 1
- read_csv: parameter usecols has wrong type hint HOT 17
- GroupBy[Series].count() should have return type Series[int] HOT 1
- Check incorrect when using a TimestampSeries and YearEnd from pandas.tseries.offsets HOT 1
- Pandas stubs forces numpy <2.0.0 for python < 3.12 HOT 1
- Restore nightly CI build due to new pandas version (3.0.0)
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 pandas-stubs.