Skip to content

Instantly share code, notes, and snippets.

@grisaitis
Last active August 26, 2015 15:02
Show Gist options
  • Save grisaitis/170e82a008480acb4fa3 to your computer and use it in GitHub Desktop.
Save grisaitis/170e82a008480acb4fa3 to your computer and use it in GitHub Desktop.
# For a comment on this SO answer: http://stackoverflow.com/a/19726078/781938
import pandas as pd
# create a DataFrame with two columns: 'a' and 'A'
data = pd.DataFrame({'a':[1],'A':[2]})
# print the result
print data
# prints:
# A a
# 0 2 1
# convert the column names to lowercase
data.columns = map(str.lower, data.columns)
# print again
print data
# prints
# a a
# 0 2 1
# print column 'a'
print data['a']
# prints:
# a a
# 0 2 1
# which is a little funky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment