-1

Here is my code:

FULLNAME_len = 65
FIRST_len = 45
LAST_len = 45
ADDRESS_1_len = 55
CITY_len = 40
STATE_len = 2
ZIP_len = 10

Now I want to get these values given the name (i.e. FULLNAME, FIRST, ...)

for col_name in df.columns:
        print(col_name_len) # Doesn't work for obvious reasons

1 Answers1

0

If you want to print the length of each column, you can do it like this:

for col in df:
     print(col, df[col].shape[0])

If that's not it I think we'd need to know where you got those hard-coded values from and what you're end-goal is.

semblable
  • 767
  • 8
  • 24