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
Implement DataFrame.idxmin
and DataFrame.idxmax
#352
Comments
I'll do this. This can be broken into two: |
For index the following can be done. To match output with pandas This can be achievable using top hits aggregation, curl -X GET "localhost:9200/flights/_search?pretty" -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
"top_AvgTicketPrice": {
"top_hits": {
"sort": [
{
"AvgTicketPrice": {
"order": "desc"
}
}
],
"_source": {
"includes": [
"_id",
"AvgTicketPrice"
]
},
"size": 1
}
},
"top_FlightDelayMin": {
"top_hits": {
"sort": [
{
"FlightDelayMin": {
"order": "desc"
}
}
],
"_source": {
"includes": [
"_id",
"FlightDelayMin"
]
},
"size": 1
}
},
"top_dayOfWeek": {
"top_hits": {
"sort": [
{
"dayOfWeek": {
"order": "desc"
}
}
],
"_source": {
"includes": [
"_id",
"dayOfWeek"
]
},
"size": 1
}
}
}
}
' Output: {
"took" : 13,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"top_dayOfWeek" : {
"hits" : {
"total" : {
"value" : 13059,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "flights",
"_type" : "_doc",
"_id" : "1988",
"_score" : null,
"_source" : {
"dayOfWeek" : 6
},
"sort" : [
6
]
}
]
}
},
"top_AvgTicketPrice" : {
"hits" : {
"total" : {
"value" : 13059,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "flights",
"_type" : "_doc",
"_id" : "1843",
"_score" : null,
"_source" : {
"AvgTicketPrice" : 1199.7290528077556
},
"sort" : [
1199.729
]
}
]
}
},
"top_FlightDelayMin" : {
"hits" : {
"total" : {
"value" : 13059,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "flights",
"_type" : "_doc",
"_id" : "109",
"_score" : null,
"_source" : {
"FlightDelayMin" : 360
},
"sort" : [
360
]
}
]
}
}
}
} |
Merged
Closed in #353 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am thinking this should be implementable.
Reference for pandas idxmin: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.idxmin.html
Reference for pandas idxmax: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.idxmax.html
The text was updated successfully, but these errors were encountered: