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

Missing boiling_point and melting_point in fetch_table #177

Closed
eamsen opened this issue Sep 29, 2024 · 4 comments
Closed

Missing boiling_point and melting_point in fetch_table #177

eamsen opened this issue Sep 29, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@eamsen
Copy link

eamsen commented Sep 29, 2024

Describe the bug

Data returned via fetch_table does not contain the columns boiling_point and melting_point.

To Reproduce

Steps to reproduce the behavior:

from mendeleev.fetch import fetch_table
elements = fetch_table("elements")
print(elements.info())

Expected behavior

boiling_point and melting_point should be columns in the elements table.

Specification

  • 0.17.0, but older versions also seem affected
  • python 3.9.12
  • Ubuntu
@eamsen eamsen added the bug Something isn't working label Sep 29, 2024
@lmmentel lmmentel self-assigned this Sep 29, 2024
@lmmentel
Copy link
Owner

lmmentel commented Sep 29, 2024

Thanks for reaching out. The issue is that melting_point and boiling_point are in a different table called phasetransitions.

Your issue made me look into the docs and it seems that this table is missing from the data access section of the docs. I'll create a separate issue to fix that.

It seems that the python model PhaseTransition is also missing docs on the api docs page.

To get the table with phase transitions you can simply reuse the logic you have

from mendeleev.fetch import fetch_table
pt = fetch_table("phasetransitions")
pt.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 108 entries, 0 to 107
Data columns (total 9 columns):
 #   Column                    Non-Null Count  Dtype  
---  ------                    --------------  -----  
 0   id                        108 non-null    int64  
 1   atomic_number             108 non-null    int64  
 2   boiling_point             91 non-null     float64
 3   melting_point             107 non-null    float64
 4   critical_temperature      34 non-null     float64
 5   critical_pressure         21 non-null     float64
 6   triple_point_temperature  17 non-null     float64
 7   triple_point_pressure     13 non-null     float64
 8   allotrope                 13 non-null     object 
dtypes: float64(6), int64(2), object(1)
memory usage: 7.7+ KB

An important caveat is that several elements have multiple allotropes with their separate values, e.g. for carbon:

pt[pt.atomic_number == 6]
 
    id  atomic_number  boiling_point  melting_point  critical_temperature  critical_pressure  triple_point_temperature  triple_point_pressure allotrope
16  17              6        4098.15        4762.15                   NaN                NaN                   4762.15                10300.0  graphite
17  18              6            NaN        4713.15                   NaN                NaN                       NaN                    NaN   diamond

If you want to have all the data in one table you can join the pt dataframe with elements. You might want to decide first how you want to treat the allotropes first.

Here's all the atomic numbers where there is more than one allotrope:

pt[pt['atomic_number'].duplicated()]['atomic_number'].unique()

array([ 6, 15, 34, 16, 50])

@lmmentel
Copy link
Owner

FYI I recently added a method for exporting all tables from mendeleev documented here but it requires executing commands in CLI.

@eamsen
Copy link
Author

eamsen commented Sep 29, 2024

Thank you for the swift response!
In that case, I was lead astray by the documentation, but good to know that the data is actually available through a different table.

@lmmentel
Copy link
Owner

The tutorial on data access seems a bit out of date. I've already updated some of the missing entries related to api docs and data but it seems I might have to look at the tutorials as well. I've made a separate issue #186 and therefore will close this one.

Feel free to reach out if you spot any other issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants