Mathematica Asked on May 16, 2021
I have a very long list such as:
At the end of each sublist for some reason I have {,-6}
. How can I remove that from each sublist of the list?
Thanks
EDIT
The list is generated getting data from an Excel file and for some reason at the end it gives me {,-6}
using:
Extract[Import["file.xlsx"], 1][[3 ;; All, {i, i + 1}]]
You seem to have a problem that Excel puts some errors containing string expressions. If they appear in random places but you know how they look you can delete them based on their pattern. After you import:
data=ToExpression[Import["https://pastebin.com/raw/rSVRyTge"]];
you can remove them whether by exact pattern
DeleteCases[data,{"",-6 ""},Infinity]
or some generalization
DeleteCases[data,{___,_String,___},Infinity]
Correct answer by Vitaliy Kaurov on May 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP