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

ENH: MultiIndex.dtypes #37062

Open
jreback opened this issue Oct 11, 2020 · 3 comments · May be fixed by #37073
Open

ENH: MultiIndex.dtypes #37062

jreback opened this issue Oct 11, 2020 · 3 comments · May be fixed by #37073

Comments

@jreback
Copy link
Contributor

@jreback jreback commented Oct 11, 2020

create a mi

In [13]: mi = pd.MultiIndex.from_product([[1,2,3], list('abc'), pd.date_range('20200101', periods=2, tz='UTC')], names=['int', 'string', 'dt'])                            

You can already get .dtypes, but is slightly cumbersome. I would propose adding Multidex.dtypes (we already have MultiIndex.dtype but its always object). I think this is worth the convenience api.

In [14]: mi.to_frame().dtypes                                                                                                                                              
Out[14]: 
int                     int64
string                 object
dt        datetime64[ns, UTC]
dtype: object

# we would actually implement like this.
In [15]: pd.Series({l.name: l.dtype for l in mi.levels})                                                                                                                   
Out[15]: 
int                     int64
string                 object
dt        datetime64[ns, UTC]
dtype: object
@jreback jreback added this to the Contributions Welcome milestone Oct 11, 2020
@skvrahul skvrahul linked a pull request that will close this issue Oct 12, 2020
5 of 5 tasks complete
@abdurrehman11
Copy link

@abdurrehman11 abdurrehman11 commented Oct 25, 2020

Hi, @jreback I could give a try to implement MultiIndex.dtypes, if that's okay ?

@jreback
Copy link
Contributor Author

@jreback jreback commented Oct 25, 2020

there is already a PR out for this

@abdurrehman11
Copy link

@abdurrehman11 abdurrehman11 commented Oct 25, 2020

I filtered the issues with no-assignee and this also came under that tag. I am a newbie here so anyone can guide how I can find the issues that need to be resolved yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.