Skip to content
Advertisement

Data type assigned inside nested for loop isn’t as expected

I get the error:

AttributeError: ‘float’ object has no attribute ‘lower’

When trying to compile this triple nested for loop:

JavaScript

df_row_list is a list of 18 series. I am trying to iterate through it and comb through the data. How do I assign the str data type to row_item_data so that I can use the .lower() attribute?

This is kinda what the data I am working with looks like:

JavaScript

The search parameters are looking for series containing words such as: HOLDER DESCRIPTION, CUTTER #, Operation, TOOL DESCRIPTION I created a spreadsheet that has hundreds of options stored in it that I’m going to compare with.

I would expect it to spit it out index of the series from the df_row_list (list with a number of series in it) so that I can know where the row of data I want to use as a “Title Row” is.

Or is this not even the best way to attempt to comb through a list of series for specific keywords? I’m relatively new to python and I’m open to any help.

Advertisement

Answer

Just posting incase anyone has a similar issue and is looking for a different solution

This is how I found a solution:

JavaScript

So now when I compile and output the data I get:

JavaScript

Which is cleaned up and in the order I was looking for.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement