-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH: add the parameter dropna to the function to_dict. #8385
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
Conversation
this is necessary because you cant reach the same effect by just using dropna().to_dict() also see http://stackoverflow.com/questions/26033301/make-pandas-dataframe-to-a-dict-and-dropna/26033302#26033302
this is necessary because you cant reach the same effect by just using dropna().to_dict() also see http://stackoverflow.com/questions/26033301/make-pandas-dataframe-to-a-dict-and-dropna/26033302#26033302
| this needs a test |
| actually I don't think this should be included - u can put the example in the cookbook of you would like |
|
| maybe if u explain what u r doing with it |
| why this could be usefull: and need a dict of that data. because in a dict there is an association by id:value there is no need to list all empty values with id:NaN. Instead typically you just every entry with an value is listed. But there is no way to get something like this using pandas methods. So in this case you are back on your own and have to write a dict-comprehension that somewhat like this: Of course it is possible to write your own dict-comprehension every time you need it. But it is easier and more robust if there is already a library doing this for you. API consistancy if you look up DataFrame.to_excel or DataFrame.to_html every one of it has some parameters that are special for this output type and make sence for this one but not for other ones. why using a dict Tests |
| Another possibility would be to use the I think, if we want to include the functionality proposed in this PR, using |
| ok will mark as an enhancement needs tests |
| closing pls reopen if/when updated |
| @derDieDasJojo if you would update, I think using a |
this is usefull because you cant reach the same effect by just using
dropna().to_dict() also see
http://stackoverflow.com/questions/26033301/make-pandas-dataframe-to-a-dict-and-dropna/26033302#26033302