# AttributeError: 'str' object has no attribute 'get'

**URL:** <https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [December 2, 2021, 10:23am UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362 "2021-12-02T10:23:45Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 10:23am UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/1 "2021-12-02T10:23:45Z")

</div>

‘’’

```auto
   import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

# Import data
df =pd.read_csv('medical_examination.csv')

# Add 'overweight' column
df['overweight'] = df["weight"]/((df["height"])/100*(df["height"])/100)
df.loc[df["overweight"]>25, "overweight"]=1
df.loc[df["overweight"]<=25, "overweight"]=0
# Normalize data by making 0 always good and 1 always bad. If the value of 'cholesterol' or 'gluc' is 1, make the value 0. If the value is more than 1, make the value 1.
df.loc[df["overweight"]>25, "overweight"]=1
df.loc[df["overweight"]<=25, "overweight"]=0

# Draw Categorical Plot
def draw_cat_plot():
    # Create DataFrame for cat plot using `pd.melt` using just the values from 'cholesterol', 'gluc', 'smoke', 'alco', 'active', and 'overweight'.
    df_cat = pd.melt(df, id_vars = ["cardio"], value_vars = ["cholesterol", "gluc", "alco", "active", "smoke", "overweight"])

    # Group and reformat the data to split it by 'cardio'. Show the counts of each feature. You will have to rename one of the columns for the catplot to work correctly.
    df_cat = df_cat.value_counts().reset_index(name="total")

    # Draw the catplot with 'sns.catplot()'
    var = ["active", "alco", "cholesterol", "gluc", "overweight", "smoke"]
    fig = sns.catplot(x ="variable", y= "total", hue ="value", data = "df_cat", kind = "bar", order = var, col = "cardio").fig

    # Do not modify the next two lines
    fig.savefig('catplot.png')
    return fig

# Draw Heat Map
def draw_heat_map():
    # Clean the data
    df_heat = df[(df["ap_lo"]<=df["ap_hi"])&(df["height"]>=df["height"].quantile(0.025))&(df["height"]<=df["height"].quantile(0.0975))&(df["weight"]>=df["weight"].quantile(0.025))&(df["weight"]<=df["weight"].quantile(0.0975))]

```

‘’’  
Output  
‘’’

```auto
python main.py
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-ztkaysjt because the default path (/config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import medical_data_visualizer
  File "/home/runner/boilerplate-medical-data-visualizer-3/medical_data_visualizer.py", line 7, in <module>
    df =pd.read_csv('medical_data_visualizer.csv')
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/util/_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 482, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
    self._engine = self._make_engine(self.engine)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
    return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
 python main.py
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-1t3e315s because the default path (/config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
  File "main.py", line 6, in <module>
    medical_data_visualizer.draw_cat_plot()
  File "/home/runner/boilerplate-medical-data-visualizer-3/medical_data_visualizer.py", line 28, in draw_cat_plot
    fig = sns.catplot(x ="variable", y= "total", hue ="value", data = "df_cat", kind = "bar", order = var, col = "cardio").fig
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/seaborn/_decorators.py", line 46, in inner_f
    return f(**kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/seaborn/categorical.py", line 3792, in catplot
    p.establish_variables(x_, y_, hue, data, orient, order, hue_order)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/seaborn/categorical.py", line 144, in establish_variables
    x = data.get(x, x)
AttributeError: 'str' object has no attribute 'get'

```

‘’’

---

<div class="post-metadata">

**Author:** ![Jagaya](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jagaya/32/202277_2.png) [@Jagaya](https://forum.freecodecamp.org/u/Jagaya)\
**Post date:** [December 2, 2021, 10:33am UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/2 "2021-12-02T10:33:13Z")

</div>

> [@kingdanieldavid](#):
>
> fig = sns.catplot(x =“variable”, y= “total”, hue =“value”, data = “df\_cat”, kind = “bar”, order = var, col = “cardio”).fig

`"df_cat"` is a string, you want `df_cat`.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 12:30pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/3 "2021-12-02T12:30:47Z")

</div>

thanks, that settled it

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 12:32pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/4 "2021-12-02T12:32:27Z")

</div>

But what about this  
‘’’

```auto
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

# Import data
df =pd.read_csv('medical_examination.csv')

# Add 'overweight' column
df['overweight'] = df["weight"]/((df["height"])/100*(df["height"])/100)
df.loc[df["overweight"]>25, "overweight"]=1
df.loc[df["overweight"]<=25, "overweight"]=0
# Normalize data by making 0 always good and 1 always bad. If the value of 'cholesterol' or 'gluc' is 1, make the value 0. If the value is more than 1, make the value 1.
df.loc[df["overweight"]>25, "overweight"]=1
df.loc[df["overweight"]<=25, "overweight"]=0

# Draw Categorical Plot
def draw_cat_plot():
    # Create DataFrame for cat plot using `pd.melt` using just the values from 'cholesterol', 'gluc', 'smoke', 'alco', 'active', and 'overweight'.
    df_cat = pd.melt(df, id_vars = ["cardio"], value_vars = ["cholesterol", "gluc", "alco", "active", "smoke", "overweight"])

    # Group and reformat the data to split it by 'cardio'. Show the counts of each feature. You will have to rename one of the columns for the catplot to work correctly.
    df_cat = df_cat.value_counts().reset_index(name="total")

    # Draw the catplot with 'sns.catplot()'
    var = ["active", "alco", "cholesterol", "gluc", "overweight", "smoke"]
    fig = sns.catplot(x ="variable", y= "total", hue ="value", data = df_cat, kind = "bar", order = var, col = "cardio").fig

    # Do not modify the next two lines
    fig.savefig('catplot.png')
    return fig

# Draw Heat Map
def draw_heat_map():
    # Clean the data
    df_heat = df[(df["ap_lo"]<=df["ap_hi"])&(df["height"]>=df["height"].quantile(0.025))&(df["height"]<=df["height"].quantile(0.0975))&(df["weight"]>=df["weight"].quantile(0.025))&(df["weight"]<=df["weight"].quantile(0.0975))]

    # Calculate the correlation matrix
    corr = df_heat.corr()

    # Generate a mask for the upper triangle
    mask = np.triu(np.ones_like(corr))

    # Set up the matplotlib figure
    fig, ax = plt.subplots(figsize = (12,9))

    # Draw the heatmap with 'sns.heatmap()'
    ax = sns.heatmap(corr, mask = mask, vmax =.4, square = True)

    # Do not modify the next two lines
    fig.savefig('heatmap.png')
    return fig

```

‘’’

its outputting two failures, but i cant figure out how to fix it.

‘’’

```auto
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

# Import data
df =pd.read_csv('medical_examination.csv')

# Add 'overweight' column
df['overweight'] = df["weight"]/((df["height"])/100*(df["height"])/100)
df.loc[df["overweight"]>25, "overweight"]=1
df.loc[df["overweight"]<=25, "overweight"]=0
# Normalize data by making 0 always good and 1 always bad. If the value of 'cholesterol' or 'gluc' is 1, make the value 0. If the value is more than 1, make the value 1.
df.loc[df["overweight"]>25, "overweight"]=1
df.loc[df["overweight"]<=25, "overweight"]=0

# Draw Categorical Plot
def draw_cat_plot():
    # Create DataFrame for cat plot using `pd.melt` using just the values from 'cholesterol', 'gluc', 'smoke', 'alco', 'active', and 'overweight'.
    df_cat = pd.melt(df, id_vars = ["cardio"], value_vars = ["cholesterol", "gluc", "alco", "active", "smoke", "overweight"])

    # Group and reformat the data to split it by 'cardio'. Show the counts of each feature. You will have to rename one of the columns for the catplot to work correctly.
    df_cat = df_cat.value_counts().reset_index(name="total")

    # Draw the catplot with 'sns.catplot()'
    var = ["active", "alco", "cholesterol", "gluc", "overweight", "smoke"]
    fig = sns.catplot(x ="variable", y= "total", hue ="value", data = df_cat, kind = "bar", order = var, col = "cardio").fig

    # Do not modify the next two lines
    fig.savefig('catplot.png')
    return fig

# Draw Heat Map
def draw_heat_map():
    # Clean the data
    df_heat = df[(df["ap_lo"]<=df["ap_hi"])&(df["height"]>=df["height"].quantile(0.025))&(df["height"]<=df["height"].quantile(0.0975))&(df["weight"]>=df["weight"].quantile(0.025))&(df["weight"]<=df["weight"].quantile(0.0975))]

    # Calculate the correlation matrix
    corr = df_heat.corr()

    # Generate a mask for the upper triangle
    mask = np.triu(np.ones_like(corr))

    # Set up the matplotlib figure
    fig, ax = plt.subplots(figsize = (12,9))

    # Draw the heatmap with 'sns.heatmap()'
    ax = sns.heatmap(corr, mask = mask, vmax =.4, square = True)

    # Do not modify the next two lines
    fig.savefig('heatmap.png')
    return fig

```

‘’’

---

<div class="post-metadata">

**Author:** ![Jagaya](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jagaya/32/202277_2.png) [@Jagaya](https://forum.freecodecamp.org/u/Jagaya)\
**Post date:** [December 2, 2021, 12:58pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/5 "2021-12-02T12:58:11Z")

</div>

> [@kingdanieldavid](#):
>
> its outputting two failures, but i cant figure out how to fix it.

The formatting of your post is hella weird - how about you just include a link to your replit?

As for the failures, it’d be nice to know the error-messages.

For the catplot, you need to add a line `fig=fig.fig` before saving - as the test is not designed for standard object sns is returning.

As for the heatmap - without error message no idea what might be wrong.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 1:02pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/6 "2021-12-02T13:02:56Z")

</div>

Am sorry for my formatting errors Jagaya, am new to this . I also have trouble successfuly posting questions on stack overflow due to my poor formatting skills. You can put me through if possible.

Here is the link to my boiler account:

Thanks for your assistance.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 1:08pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/9 "2021-12-02T13:08:38Z")

</div>

‘’’

```auto
 python main.py
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-8ch2izlw because the default path (/config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
F..[]
F
======================================================================
FAIL: test_bar_plot_number_of_bars (test_module.CatPlotTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-medical-data-visualizer-3/test_module.py", line 28, in test_bar_plot_number_of_bars
    self.assertEqual(actual, expected, "Expected a different number of bars chart.")
AssertionError: 25 != 13 : Expected a different number of bars chart.

======================================================================
FAIL: test_heat_map_values (test_module.HeatMapTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-medical-data-visualizer-3/test_module.py", line 47, in test_heat_map_values
    self.assertEqual(actual, expected, "Expected different values in heat map.")
AssertionError: Lists differ: [] != ['0.0', '0.0', '-0.0', '0.0', '-0.1', '0.5[616 chars]0.1']

Second list contains 91 additional elements.
First extra element 0:
'0.0'

Diff is 941 characters long. Set self.maxDiff to None to see it. : Expected different values in heat map.

----------------------------------------------------------------------
Ran 4 tests in 6.647s

FAILED (failures=2)
Above is the error message, and below is the link to my account
#https://replit.com/@Dandave11/boilerplate-medical-data-visualizer-3#medical_data_visualizer.py

```

‘’’

---

<div class="post-metadata">

**Author:** ![Jagaya](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jagaya/32/202277_2.png) [@Jagaya](https://forum.freecodecamp.org/u/Jagaya)\
**Post date:** [December 2, 2021, 1:37pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/10 "2021-12-02T13:37:30Z")

</div>

Yeah formatting can be tricky.

Anyway, the error messages are very helpful.  
First please look at the project files, you are actually provided with example-files which show you how an solution can look like - this way you can compare to your images and spot differences.

Your barchart is having more bars than it should have - please read the task again and look at your image, which bars shouldn’t be there (it looks like you didn’t normalize the data).

Your heatmap is lacking annotations. Please refer to the seaborn documentation about heatmaps and it should tell you, how to add those.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 2:13pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/11 "2021-12-02T14:13:32Z")

</div>

Thank you so much, i have handled the issue of normalizing the data. But what i cant figure out now is the heatmap and the annotations stuff…please any more hint.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 2:36pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/12 "2021-12-02T14:36:00Z")

</div>

i tried working on the antonnation and got this  
‘’’

```auto
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-7wkwepa8 because the default path (/config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
...['0.0', '0.0', '0.0', '-0.0', '-0.0', '-0.0', '-0.0', '-0.0', '-0.1', '0.1', '0.0', '0.3', '0.0', '-0.0', '0.1', '0.0', '0.2', '0.0', '0.0', '0.1', '0.7', '0.0', '0.1', '-0.0', '-0.0', '0.0', '0.1', '0.1', '-0.0', '0.0', '-0.0', '0.0', '0.0', '0.1', '0.0', '0.3', '0.0', '0.0', '0.3', '-0.0', '-0.1', '0.0', '0.0', '0.0', '0.0', '0.0', '0.1', '0.2', '-0.0', '-0.0', '0.1', '0.1', '0.1', '0.0', '0.3', '0.0', '-0.0', '-0.0', '0.0', '0.0', '-0.0', '0.0', '-0.0', '0.0', '0.1', '-0.0', '0.0', '0.3', '-0.1', '-0.1', '0.0', '0.4', '0.3', '0.2', '0.1', '0.0', '0.0', '-0.0']
F
======================================================================
FAIL: test_heat_map_values (test_module.HeatMapTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-medical-data-visualizer-3/test_module.py", line 47, in test_heat_map_
 python main.py
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-2ab5glp7 because the default path (/config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
...['0.0', '0.0', '0.0', '-0.0', '-0.0', '-0.0', '-0.0', '-0.0', '-0.1', '0.1', '0.0', '0.3', '0.0', '-0.0', '0.1', '0.0', '0.2', '0.0', '0.0', '0.1', '0.7', '0.0', '0.1', '-0.0', '-0.0', '0.0', '0.1', '0.1', '-0.0', '0.0', '-0.0', '0.0', '0.0', '0.1', '0.0', '0.3', '0.0', '0.0', '0.3', '-0.0', '-0.1', '0.0', '0.0', '0.0', '0.0', '0.0', '0.1', '0.2', '-0.0', '-0.0', '0.1', '0.1', '0.1', '0.0', '0.3', '0.0', '-0.0', '-0.0', '0.0', '0.0', '-0.0', '0.0', '-0.0', '0.0', '0.1', '-0.0', '0.0', '0.3', '-0.1', '-0.1', '0.0', '0.4', '0.3', '0.2', '0.1', '0.0', '0.0', '-0.0']
F
======================================================================
FAIL: test_heat_map_values (test_module.HeatMapTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-medical-data-visualizer-3/test_module.py", line 47, in test_heat_map_values
    self.assertEqual(actual, expected, "Expected different values in heat map.")
AssertionError: Lists differ: ['0.0', '0.0', '0.0', '-0.0', '-0.0', '-0.0', '-0.0', '-0[507 chars]0.0'] != ['0.0', '0.0', '-0.0', '0.0', '-0.1', '0.5', '0.0', '0.1'[601 chars]0.1']

First differing element 2:
'0.0'
'-0.0'

Second list contains 13 additional elements.
First extra element 78:
'-0.0'

Diff is 1537 characters long. Set self.maxDiff to None to see it. : Expected different values in heat map.

----------------------------------------------------------------------
Ran 4 tests in 7.538s

FAILED (failures=1)


```

‘’’

3https://replit.com/@Dandave11/boilerplate-medical-data-visualizer-3#medical\_data\_visualizer.py

can u help me figure out what i still need to do

---

<div class="post-metadata">

**Author:** ![Jagaya](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jagaya/32/202277_2.png) [@Jagaya](https://forum.freecodecamp.org/u/Jagaya)\
**Post date:** [December 2, 2021, 3:13pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/13 "2021-12-02T15:13:46Z")

</div>

Looking at your heatmap and the provided example - your “overweight” column is broken. I think the way you clean it would turn ALL entries to 0.

And you are calculating the wrong quantiles.  
If 0.025 represents 2.5%, then 0.0975 cannot be 97.5%

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 3:56pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/14 "2021-12-02T15:56:00Z")

</div>

honestly speaking, i dont know what else to do. I have corrected the percentile to 0.975.  
This is the way i cleaned the overweight column:

```auto
df.loc[df["overweight"]>25, "overweight"]=1

df.loc[df["overweight"]<=25, "overweight"]=0

```

But i dont know what else to do.

---

<div class="post-metadata">

**Author:** ![Jagaya](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jagaya/32/202277_2.png) [@Jagaya](https://forum.freecodecamp.org/u/Jagaya)\
**Post date:** [December 2, 2021, 6:05pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/15 "2021-12-02T18:05:41Z")

</div>

The problem is, you turn all values above 25 to 1. Then you turn all values below 25 (which includes 1) to 0 → so you’ve turned all values to 0.

There are a couple of other options. You can create a temporary column, use df as reference for df\_heat, use a couple of transformer-methods (.map, .apply, maybe more) or just think about how to write those two statements so they don’t interfere with eachother.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 8:45pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/16 "2021-12-02T20:45:35Z")

</div>

Thanks so much Jagaya. I used the lambda funtion, and it solved the problem. Am so grateful.

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [December 2, 2021, 8:48pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/17 "2021-12-02T20:48:08Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 2, 2021, 8:59pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/18 "2021-12-02T20:59:24Z")

</div>

Thank you so much, I think I have learnt how to properly insert backticks(```).

---

<div class="post-metadata">

**Author:** ![Jagaya](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jagaya/32/202277_2.png) [@Jagaya](https://forum.freecodecamp.org/u/Jagaya)\
**Post date:** [December 2, 2021, 9:27pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/19 "2021-12-02T21:27:48Z")

</div>

> [@kingdanieldavid](#):
>
> I used the lambda funtion, and it solved the problem.

Good to hear and well done 😉  
As I said, there are several other options and once you work with larger datasets, it’s worth exploring them, as some are significantly faster than others. But there is always more to learn, so don’t forget to celebrate your achievements inbetween.

---

<div class="post-metadata">

**Author:** ![kingdanieldavid](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kingdanieldavid/32/239538_2.png) [@kingdanieldavid](https://forum.freecodecamp.org/u/kingdanieldavid)\
**Post date:** [December 3, 2021, 11:05am UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/20 "2021-12-03T11:05:50Z")

</div>

yeah, thanks alot Jagaya. You have been kind and very helpful.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [June 3, 2022, 11:05pm UTC](https://forum.freecodecamp.org/t/attributeerror-str-object-has-no-attribute-get/487362/21 "2022-06-03T23:05:53Z")

</div>

Closed on June 3, 2022, 11:05pm UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
