Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes to make pandas 1.4.0 work #1421

Merged
merged 5 commits into from
Jan 26, 2022
Merged

Minor changes to make pandas 1.4.0 work #1421

merged 5 commits into from
Jan 26, 2022

Conversation

zaneselvans
Copy link
Member

@zaneselvans zaneselvans commented Jan 22, 2022

A PR to fix anything that Pandas 1.4.0 breaks. Draft for now because I am running tox -e nuke locally.

The full ETL + data validation works with this PR, but it's also giving a warning about converting between naive & timezone aware datetime objects using df.astype() and I'm concerned that using apply_pudl_dtypes() across the board may be messing up timezone info. But I think that's a separate issue (See: #1423)

@codecov
Copy link

codecov bot commented Jan 22, 2022

Codecov Report

Merging #1421 (94dd108) into dev (ab419c9) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1421      +/-   ##
==========================================
+ Coverage   83.46%   83.48%   +0.02%     
==========================================
  Files          64       64              
  Lines        6930     6937       +7     
==========================================
+ Hits         5784     5791       +7     
  Misses       1146     1146              
Impacted Files Coverage Δ
src/pudl/analysis/mcoe.py 92.73% <ø> (ø)
src/pudl/extract/epacems.py 97.67% <ø> (ø)
src/pudl/output/eia860.py 65.88% <ø> (ø)
src/pudl/extract/eia860m.py 100.00% <100.00%> (ø)
src/pudl/extract/excel.py 95.83% <100.00%> (+0.04%) ⬆️
src/pudl/glue/ferc1_eia.py 80.00% <100.00%> (+0.13%) ⬆️
src/pudl/output/ferc714.py 93.25% <100.00%> (ø)
src/pudl/transform/eia.py 95.51% <100.00%> (ø)
src/pudl/transform/eia861.py 97.01% <100.00%> (+0.03%) ⬆️
src/pudl/transform/eia923.py 93.97% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab419c9...94dd108. Read the comment docs.

@zaneselvans zaneselvans marked this pull request as ready for review January 24, 2022 16:08
Copy link
Member

@bendnorman bendnorman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! It seems like the timezone thing isn't a huge issue? Maybe we address it in a separate PR.

1.4.0 added support for reading csvs with pyarrow. I'm going to experiment running CEMS using the pyarrow engine for pd.read_csv()

src/pudl/extract/excel.py Show resolved Hide resolved
@zaneselvans
Copy link
Member Author

Yeah, I created another issue for the timezone thing, but I do think we should investigate it and come up with a way to treat the timezone aware/naive columns appropriately.

We need to give pd.read_csv() a dtype template of some kind when it's reading in the CEMS files, otherwise when the column is empty it gets assigned one type, and when it's got data it's assigned another type, and when the dataframes are concatenated together you get inhomogeneous "object" types which slow down subsequent operations. But it's slightly more complicated because not all of the possible columns appear in every file, so the dtype dictionary has to somehow be sensitive to that. I fiddled with it a bit and gave up.

@zaneselvans zaneselvans merged commit 6280387 into dev Jan 26, 2022
@zaneselvans zaneselvans deleted the pandas-1.4.0 branch January 26, 2022 01:45
This was referenced Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants