lowercase

'DataFrame' object has no attribute 'column'

'DataFrame' object has no attribute 'column' Question: I’m trying to retrieve the column names of a dataframe, all in lower case, but that’s giving me the following Attribute Error: ‘DataFrame’ object has no attribute ‘column’. import pandas as pd df = pd.read_csv(‘C:/dataset.csv’) col_names=df.column.values.lower() print(col_names) Why is this error showing up & how do I fix …

Total answers: 1

Uppercase every other word in a string using split/join

Uppercase every other word in a string using split/join Question: I have a string: string = "Hello World" That needs changing to: "hello WORLD" Using only split and join in Python. Any help? string = "Hello World" split_str = string.split() Can’t then work out how to get first word to lowercase second word to uppercase …

Total answers: 4

Python change lowercase to uppercase

Python change lowercase to uppercase Question: I need help with python program. I don’t know how to make python change at least 1 lowercase letter to uppercase. from random import * import random pin="" lenght=random.randrange(8,15) for i in range(lenght): pin=pin+chr(randint(97,122)) print(pin) Asked By: ado || Source Answers: I give it a shot with the little …

Total answers: 4

Converting list into lowercase

Converting list into lowercase Question: enter image description here I want to convert the list into lower case but my output converts the last index object into a list in lower case. where am i going wrong? must be a lame question but i am super new to coding. Asked By: vikrammane8377 || Source Answers: …

Total answers: 1

Best Way to Implement a Custom lower() method in Python

Best Way to Implement a Custom lower() method in Python Question: I have an assignment where I’m not allowed to use the .lower() function so I’m creating my own. At the moment I have two ideas on how to do this but would love some input on what the most efficient way would be. Method …

Total answers: 4

Case-insensitive comparison of lists

Case-insensitive comparison of lists Question: I want to make a code that to see if each new username has already been used in a website. I have this code: current_users = [‘Rachel’, ‘Ross’, ‘Chandler’, ‘Joey’, ‘Monica’] new_users = [‘Janice’, ‘Ben’, ‘Phoebe’, ‘JOEY’] for new_user in new_users: if new_user in current_users: print (f’The username {new_user} is …

Total answers: 1

List element case conversion

List element case conversion Question: I have a list that has 12 elements. I am getting an input and matching that input with the value of another variable. Now that means that case-sensitivity will be a problem. I know how to go through the list with a loop but how can I convert every character …

Total answers: 1

python: how to make list with all lowercase?

python: how to make list with all lowercase? Question: Suppose I have some data like: data[0] = [‘I want to make everything lowercase’] data[1] = [‘How Do I Do It’] data[2] = [‘With A Large DataSet’] How do I repeatedly call the lower() function on all the elements of data, to make all the of …

Total answers: 2

Convert whole dataframe from lower case to upper case with Pandas

Convert whole dataframe from lower case to upper case with Pandas Question: I have a dataframe like the one displayed below: # Create an example dataframe about a fictional army raw_data = {‘regiment’: [‘Nighthawks’, ‘Nighthawks’, ‘Nighthawks’, ‘Nighthawks’], ‘company’: [‘1st’, ‘1st’, ‘2nd’, ‘2nd’], ‘deaths’: [‘kkk’, 52, ’25’, 616], ‘battles’: [5, ’42’, 2, 2], ‘size’: [‘l’, ‘ll’, …

Total answers: 8