QGIS: Delete all records/rows with NULL values

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
3
down vote

favorite












I have joined a CSV file to a shapefile by a common key in QGIS. Not all records in the shapefile and CSV had corresponding keys.



This left some records in the shapefile as NULL.



i.e.



 City School_ID ID_no Total
London 1234 1234 12
Glasgow 4321 4321 10
Bristol 4444 NULL NULL


This is just a small slice of the data. The actual data has about 12000 records.



Is there any way to delete all records/rows with NULL values?







share|improve this question


















  • 1




    Can't you just sort the data, so all NULL values are on top or bottom of the attribute table, then manually highlight the rows and delete them? Even with 12000 records it should be easily done.
    – gHupf
    Aug 17 at 13:36











  • Hi @gHupf, my sentiments exactly. However, there only seems to be an option to delete fields, as opposed to delete rows.
    – kris_Co2
    Aug 17 at 13:41











  • Hi @BERA, thank you for your reply. I know ArcGis allows you to keep only matching records, but in QGIS when joining vectors - there does not appear to be an option to select "join only matcihng records".
    – kris_Co2
    Aug 17 at 13:48
















up vote
3
down vote

favorite












I have joined a CSV file to a shapefile by a common key in QGIS. Not all records in the shapefile and CSV had corresponding keys.



This left some records in the shapefile as NULL.



i.e.



 City School_ID ID_no Total
London 1234 1234 12
Glasgow 4321 4321 10
Bristol 4444 NULL NULL


This is just a small slice of the data. The actual data has about 12000 records.



Is there any way to delete all records/rows with NULL values?







share|improve this question


















  • 1




    Can't you just sort the data, so all NULL values are on top or bottom of the attribute table, then manually highlight the rows and delete them? Even with 12000 records it should be easily done.
    – gHupf
    Aug 17 at 13:36











  • Hi @gHupf, my sentiments exactly. However, there only seems to be an option to delete fields, as opposed to delete rows.
    – kris_Co2
    Aug 17 at 13:41











  • Hi @BERA, thank you for your reply. I know ArcGis allows you to keep only matching records, but in QGIS when joining vectors - there does not appear to be an option to select "join only matcihng records".
    – kris_Co2
    Aug 17 at 13:48












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I have joined a CSV file to a shapefile by a common key in QGIS. Not all records in the shapefile and CSV had corresponding keys.



This left some records in the shapefile as NULL.



i.e.



 City School_ID ID_no Total
London 1234 1234 12
Glasgow 4321 4321 10
Bristol 4444 NULL NULL


This is just a small slice of the data. The actual data has about 12000 records.



Is there any way to delete all records/rows with NULL values?







share|improve this question














I have joined a CSV file to a shapefile by a common key in QGIS. Not all records in the shapefile and CSV had corresponding keys.



This left some records in the shapefile as NULL.



i.e.



 City School_ID ID_no Total
London 1234 1234 12
Glasgow 4321 4321 10
Bristol 4444 NULL NULL


This is just a small slice of the data. The actual data has about 12000 records.



Is there any way to delete all records/rows with NULL values?









share|improve this question













share|improve this question




share|improve this question








edited Aug 17 at 16:28









nmtoken

7,55642762




7,55642762










asked Aug 17 at 13:27









kris_Co2

1085




1085







  • 1




    Can't you just sort the data, so all NULL values are on top or bottom of the attribute table, then manually highlight the rows and delete them? Even with 12000 records it should be easily done.
    – gHupf
    Aug 17 at 13:36











  • Hi @gHupf, my sentiments exactly. However, there only seems to be an option to delete fields, as opposed to delete rows.
    – kris_Co2
    Aug 17 at 13:41











  • Hi @BERA, thank you for your reply. I know ArcGis allows you to keep only matching records, but in QGIS when joining vectors - there does not appear to be an option to select "join only matcihng records".
    – kris_Co2
    Aug 17 at 13:48












  • 1




    Can't you just sort the data, so all NULL values are on top or bottom of the attribute table, then manually highlight the rows and delete them? Even with 12000 records it should be easily done.
    – gHupf
    Aug 17 at 13:36











  • Hi @gHupf, my sentiments exactly. However, there only seems to be an option to delete fields, as opposed to delete rows.
    – kris_Co2
    Aug 17 at 13:41











  • Hi @BERA, thank you for your reply. I know ArcGis allows you to keep only matching records, but in QGIS when joining vectors - there does not appear to be an option to select "join only matcihng records".
    – kris_Co2
    Aug 17 at 13:48







1




1




Can't you just sort the data, so all NULL values are on top or bottom of the attribute table, then manually highlight the rows and delete them? Even with 12000 records it should be easily done.
– gHupf
Aug 17 at 13:36





Can't you just sort the data, so all NULL values are on top or bottom of the attribute table, then manually highlight the rows and delete them? Even with 12000 records it should be easily done.
– gHupf
Aug 17 at 13:36













Hi @gHupf, my sentiments exactly. However, there only seems to be an option to delete fields, as opposed to delete rows.
– kris_Co2
Aug 17 at 13:41





Hi @gHupf, my sentiments exactly. However, there only seems to be an option to delete fields, as opposed to delete rows.
– kris_Co2
Aug 17 at 13:41













Hi @BERA, thank you for your reply. I know ArcGis allows you to keep only matching records, but in QGIS when joining vectors - there does not appear to be an option to select "join only matcihng records".
– kris_Co2
Aug 17 at 13:48




Hi @BERA, thank you for your reply. I know ArcGis allows you to keep only matching records, but in QGIS when joining vectors - there does not appear to be an option to select "join only matcihng records".
– kris_Co2
Aug 17 at 13:48










1 Answer
1






active

oldest

votes

















up vote
9
down vote



accepted










In the attribute table, choose Select by Expression and write "FIELD_NAME" IS null (replace FIELD_NAME with your actual field names, of course). Click "Select Features", then simply delete the resulting selected features.






share|improve this answer




















  • Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
    – kris_Co2
    Aug 17 at 13:46






  • 3




    Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
    – Erik
    Aug 17 at 13:47











  • If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
    – gHupf
    Aug 17 at 13:48










  • You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
    – Nathan
    Aug 17 at 13:53










  • @Erik - thank you so much ! I did not have the editing setting on!
    – kris_Co2
    Aug 17 at 14:00










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f293141%2fqgis-delete-all-records-rows-with-null-values%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
9
down vote



accepted










In the attribute table, choose Select by Expression and write "FIELD_NAME" IS null (replace FIELD_NAME with your actual field names, of course). Click "Select Features", then simply delete the resulting selected features.






share|improve this answer




















  • Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
    – kris_Co2
    Aug 17 at 13:46






  • 3




    Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
    – Erik
    Aug 17 at 13:47











  • If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
    – gHupf
    Aug 17 at 13:48










  • You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
    – Nathan
    Aug 17 at 13:53










  • @Erik - thank you so much ! I did not have the editing setting on!
    – kris_Co2
    Aug 17 at 14:00














up vote
9
down vote



accepted










In the attribute table, choose Select by Expression and write "FIELD_NAME" IS null (replace FIELD_NAME with your actual field names, of course). Click "Select Features", then simply delete the resulting selected features.






share|improve this answer




















  • Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
    – kris_Co2
    Aug 17 at 13:46






  • 3




    Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
    – Erik
    Aug 17 at 13:47











  • If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
    – gHupf
    Aug 17 at 13:48










  • You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
    – Nathan
    Aug 17 at 13:53










  • @Erik - thank you so much ! I did not have the editing setting on!
    – kris_Co2
    Aug 17 at 14:00












up vote
9
down vote



accepted







up vote
9
down vote



accepted






In the attribute table, choose Select by Expression and write "FIELD_NAME" IS null (replace FIELD_NAME with your actual field names, of course). Click "Select Features", then simply delete the resulting selected features.






share|improve this answer












In the attribute table, choose Select by Expression and write "FIELD_NAME" IS null (replace FIELD_NAME with your actual field names, of course). Click "Select Features", then simply delete the resulting selected features.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 17 at 13:41









Nathan

52029




52029











  • Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
    – kris_Co2
    Aug 17 at 13:46






  • 3




    Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
    – Erik
    Aug 17 at 13:47











  • If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
    – gHupf
    Aug 17 at 13:48










  • You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
    – Nathan
    Aug 17 at 13:53










  • @Erik - thank you so much ! I did not have the editing setting on!
    – kris_Co2
    Aug 17 at 14:00
















  • Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
    – kris_Co2
    Aug 17 at 13:46






  • 3




    Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
    – Erik
    Aug 17 at 13:47











  • If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
    – gHupf
    Aug 17 at 13:48










  • You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
    – Nathan
    Aug 17 at 13:53










  • @Erik - thank you so much ! I did not have the editing setting on!
    – kris_Co2
    Aug 17 at 14:00















Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
– kris_Co2
Aug 17 at 13:46




Hi Nathan, Thank you for replying. There does not seem to be a delete button for records in the attributes view. The only delete button seems to correspond to fields or columns. THis is where I am having the issue.
– kris_Co2
Aug 17 at 13:46




3




3




Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
– Erik
Aug 17 at 13:47





Allow editing for the layer (maybe you have to save it as a shapefile first), then there's this nice red trash bin you can use to dispose of your unwanted features. You cannot delete single table fields, only rows or columns.
– Erik
Aug 17 at 13:47













If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
– gHupf
Aug 17 at 13:48




If you click on the number on the left of the attribute table, the whole row gets highlighted and you can just delete it.
– gHupf
Aug 17 at 13:48












You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
– Nathan
Aug 17 at 13:53




You can also choose Edit->Cut features (or use the scissors icon that's right next to the trash bin) if you want to keep the features in your clipboard.
– Nathan
Aug 17 at 13:53












@Erik - thank you so much ! I did not have the editing setting on!
– kris_Co2
Aug 17 at 14:00




@Erik - thank you so much ! I did not have the editing setting on!
– kris_Co2
Aug 17 at 14:00

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f293141%2fqgis-delete-all-records-rows-with-null-values%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery