Comments (7)
This is the reason why #209 fails
from hydropandas.
Happened to me after updating pandas to v.2.2.2
Updating pandas (2.2.1 -> 2.2.2)
from hydropandas.
Not sure if we need to do something with this. #209 is already fixed.
Maybe if behavior keeps existing after v2.2.2 we need to adress this.
from hydropandas.
It has become an issue in the bro_bronhouder notebook now as well. I think it has something to do with this error: pandas-dev/pandas#57032
from hydropandas.
Geopandas had the same problem: geopandas/geopandas#3060
from hydropandas.
For now I will pin the pandas version to 2.2.1 or lower because this also gives errors in nlmod.
from hydropandas.
It seems like a change in pandas behavior that caused this issue can actually help to improve hydropandas.
Behavior pandas <=2.2.1:
oc.loc[:, ["x", "y"]]
returned an ObsCollection. Just like in geopandas:
gdf.loc[:, ['id']]
would return a GeoDataframe
Recent changes to pandas (=2.2.2) changed this behavior in such a way that:
oc.loc[:, ["x", "y"]]
returns a DataFrame. Due to this behavior the ObsCollection constructor would attach an Obs column to it. I was quite surprised that the loc function calls the constructor when it returns an object but apparently it does.
I added an extra check to the constructor to see if it was called using a DataFrame and an obs_list/ObsClass. Only if one of the obs_list/ObsClass is given the 'obs' column is attached.
We should improve hydropandas further by following the behavior of Geopandas. If you slice an ObsCollection without the 'obs' column a DataFrame should be returned. Now an ObsCollection without the 'obs' column is returned which is an invalid ObsCollection.
We could even think about supporting an ObsSeries. Atm when you obtain a single column from an ObsCollection it will always return a pandas Series. For now I don't really like to do this. I think this adds more headache than hooray.
from hydropandas.
Related Issues (20)
- Separate API calls from reading logic for testing
- Codacy coverage fails HOT 1
- issues Lizard functions HOT 3
- Cannot read BRO uitgiftedocument HOT 1
- update requirements? HOT 2
- Speed Up API Calls with Concurrent Programming HOT 2
- figure filename in `series_per_group` HOT 1
- Support Quality Controlled Rain Gauge Data from KNMI Data Platform
- fill missing obs behavior changed with KNMI update HOT 1
- laad dino file met data --> krijg een hpd-object zonder data HOT 3
- Add one hour to hourly knmi-data HOT 3
- Error in `test_interpolate_obscollection` HOT 1
- Plot observations per hydrological year HOT 5
- unexpected behaviour `plots.series_per_group` HOT 3
- test `test_bro_extent_too_big` fails
- return DataFrame instead of invalid ObsCollection
- BRO location with 2 filters: returns only first filter with read_bro HOT 6
- Sometimes I get an invalid response when calling `_get_gmw_from_bro_id` HOT 2
- Create an `Observation` dtype.
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 hydropandas.