I have a dataframe like the one displayed below:
# Create an example dataframe about a fictional armyraw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Nighthawks', 'Nighthawks'], 'company': ['1st', '1st', '2nd', '2nd'], 'deaths': ['kkk', 52, '25', 616], 'battles': [5, '42', 2, 2], 'size': ['l', 'll', 'l', 'm']}df = pd.DataFrame(raw_data, columns = ['regiment', 'company', 'deaths', 'battles', 'size'])
My goal is to transform every single string inside of the dataframe to upper case so that it looks like this:
Notice: all data types are objects and must not be changed; the output must contain all objects. I want to avoid to convert every single column one by one... I would like to do it generally over the whole dataframe possibly.
What I tried so far is to do this but without success
df.str.upper()
I need to make a function that reads a string input and converts the odd indexed characters in the string to upperCase and the even ones to lowerCase.
function alternativeCase(string){ for(var i = 0; i < string.length; i++){ if (i % 2 != 0) { string[i].toUpperCase(); } else { string[i].toLowerCase(); } } return string;}
How to fix my code?
I am trying to create tables in mysql with flask-sqlalchemy. My problem is that the classnames always start with capital letters while I would like to create all tables with lowercase.
Is there a way to fix that? I read that the default behaviour of the flask-sqlalchemy is converting it to lowercase, but it does not seem to work for me.
Thanks for any advice :)
I am trying to get a xpath query using the xpath function lower-case
or upper-case
, but they seem to not work in selenium (where I test my xpath before I apply it).
Example that does NOT work:
//*[.=upper-case('some text')]
I have no problem locating the nodes I need in complex path and even using aggregated functions, as long as I don't use the upper and lower case.
Has anyone encountered this before? Does it make sense?
Thanks.
What is the best practice?
<HTML> or <html>
And why we should stick with one particular case?
However all browsers seems to interpret both cases and returns the expected output.
Please note that by viewing our site you agree to our use of cookies (see Magánélet for details). You will only see this message once.