Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/5414.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix sorting of lists with numbers and missing entries.
5 changes: 3 additions & 2 deletions pythonFiles/datascience/getJupyterVariableDataFrameInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
_VSCODE_columnTypes = []
_VSCODE_columnNames = []
if _VSCODE_targetVariable['type'] == 'list':
_VSCODE_columnTypes = ['string'] # Might be able to be more specific here?
_VSCODE_columnNames = ['_VSCode_JupyterValuesColumn']
_VSCODE_evalResult = _VSCODE_pd.DataFrame(_VSCODE_evalResult)
_VSCODE_columnTypes = list(_VSCODE_evalResult.dtypes)
_VSCODE_columnNames = list(_VSCODE_evalResult)
elif _VSCODE_targetVariable['type'] == 'Series':
_VSCODE_evalResult = _VSCODE_pd.Series.to_frame(_VSCODE_evalResult)
_VSCODE_columnTypes = list(_VSCODE_evalResult.dtypes)
Expand Down
2 changes: 1 addition & 1 deletion pythonFiles/datascience/getJupyterVariableDataFrameRows.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Assume we have a dataframe. If not, turn our eval result into a dataframe
_VSCODE_df = _VSCODE_evalResult
if (_VSCODE_targetVariable['type'] == 'list'):
_VSCODE_df = _VSCODE_pd.DataFrame({'_VSCode_JupyterValuesColumn':_VSCODE_evalResult})
_VSCODE_df = _VSCODE_pd.DataFrame(_VSCODE_evalResult)
elif (_VSCODE_targetVariable['type'] == 'Series'):
_VSCODE_df = _VSCODE_pd.Series.to_frame(_VSCODE_evalResult)
elif _VSCODE_targetVariable['type'] == 'dict':
Expand Down
4 changes: 2 additions & 2 deletions src/datascience-ui/data-explorer/mainPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
// or it will take too long
const comparer = isStringColumn ?
(a: any, b: any): number => {
const aVal = a[sortColumn] as string;
const bVal = b[sortColumn] as string;
const aVal = a[sortColumn] ? a[sortColumn].toString() : '';
const bVal = b[sortColumn] ? b[sortColumn].toString() : '';
const aStr = aVal ? aVal.substring(0, Math.min(aVal.length, MaxStringCompare)) : aVal;
const bStr = bVal ? bVal.substring(0, Math.min(bVal.length, MaxStringCompare)) : bVal;
const result = aStr > bStr ? -1 : 1;
Expand Down