Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Standardize Text Case | Foundations of Data Cleaning
Python for Data Cleaning

bookChallenge: Standardize Text Case

Consistent text formatting is essential for reliable data analysis and grouping. When text data contains a mix of uppercase, lowercase, or capitalized words, grouping and comparison operations can yield misleading results. For instance, "Apple", "apple", and "APPLE" might all refer to the same value, but without standardization, they are treated as distinct entries. By ensuring that all text values in a column use the same case, you simplify grouping and aggregation, reduce errors, and make your data easier to work with.

12345678
import pandas as pd data = { "fruit": ["Apple", "banana", "ORANGE", "apple", "Banana", "orange"], "quantity": [5, 3, 4, 2, 1, 6] } df = pd.DataFrame(data) print(df)
copy
Tarefa

Swipe to start coding

Write a function that standardizes all values in a specified column of a DataFrame to lowercase. The function should return a new DataFrame with the values in the given column converted to lowercase, while leaving all other columns unchanged.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 6
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

Awesome!

Completion rate improved to 5.56

bookChallenge: Standardize Text Case

Deslize para mostrar o menu

Consistent text formatting is essential for reliable data analysis and grouping. When text data contains a mix of uppercase, lowercase, or capitalized words, grouping and comparison operations can yield misleading results. For instance, "Apple", "apple", and "APPLE" might all refer to the same value, but without standardization, they are treated as distinct entries. By ensuring that all text values in a column use the same case, you simplify grouping and aggregation, reduce errors, and make your data easier to work with.

12345678
import pandas as pd data = { "fruit": ["Apple", "banana", "ORANGE", "apple", "Banana", "orange"], "quantity": [5, 3, 4, 2, 1, 6] } df = pd.DataFrame(data) print(df)
copy
Tarefa

Swipe to start coding

Write a function that standardizes all values in a specified column of a DataFrame to lowercase. The function should return a new DataFrame with the values in the given column converted to lowercase, while leaving all other columns unchanged.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 6
single

single

some-alt