Skip to main content
Solved

Filling in blank attributes based on a separate grouping attribute


Forum|alt.badge.img

Hi there,

I have some data where one column is only sparsely filled, and I want to fill these missing ones based on another present attribute. Here's a basic representation:

ClassTypeMammalDog

 

DogFishTrout

 

Trout

 

TroutReptileLizard

 

Lizard

 

What I need to do is fill in all the empty "Class" lines based on the "Type". In the data, each Type will always have at least one entry in Class (aka, no Type will ever be classless), and no Type will have more than one class.

So in short, my current data may have 3 entries with "Trout" and only one of those specify the class as "Fish". What I want is to derive the info from that one Type entry, and fill in all the blank Class lines.

 

Thanks in advance for any tips!

 

Best regards,

Best answer by ebygomm

If you sort your data by Type, you can use the adjacent Attribute Handling in the attributecreator to fill in the blanks in class by using the preceding feature value.

You could also test for the non blank values and then featuremerge them back to the original data

View original
Did this help you find an answer to your question?

5 replies

ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • Best Answer
  • February 11, 2019

If you sort your data by Type, you can use the adjacent Attribute Handling in the attributecreator to fill in the blanks in class by using the preceding feature value.

You could also test for the non blank values and then featuremerge them back to the original data


Forum|alt.badge.img
ebygomm wrote:

If you sort your data by Type, you can use the adjacent Attribute Handling in the attributecreator to fill in the blanks in class by using the preceding feature value.

You could also test for the non blank values and then featuremerge them back to the original data

Hi @egomm,

There's a lot of other attribute values present as well, so I'm a little scared of splitting and re-merging, as I'm cautious to not suffer any data-loss.

As for the first option you mentioned, I had a quick look but quite frankly, I have no idea of how this functionality works, as I've never before used it. I checked the help page but it is still a bit blurry. Any tips on how I should fill it in to make use of the Adjacent feature functionality?

 

Thanks!


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • February 11, 2019
robbie_botha wrote:

Hi @egomm,

There's a lot of other attribute values present as well, so I'm a little scared of splitting and re-merging, as I'm cautious to not suffer any data-loss.

As for the first option you mentioned, I had a quick look but quite frankly, I have no idea of how this functionality works, as I've never before used it. I checked the help page but it is still a bit blurry. Any tips on how I should fill it in to make use of the Adjacent feature functionality?

 

Thanks!

Can you see the image I posted? (I edited to add it after I first posted so you might have missed it, or the forum gremlins might mean it doesn't appear)


Forum|alt.badge.img
ebygomm wrote:

If you sort your data by Type, you can use the adjacent Attribute Handling in the attributecreator to fill in the blanks in class by using the preceding feature value.

You could also test for the non blank values and then featuremerge them back to the original data

Hi @egomm,

 

This work perfectly thanks. The picture popped up afterward and I followed it exactly.

 

Best regards,


Forum|alt.badge.img
  • February 11, 2019

Hi

 

As long as there is always a Class value first before any blanks then this can be done within a python caller as attached

 

You will get a nice error message if this is not the case!

Cheers

Dave

 

Filling in blank attributes.fmw


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings