Selecting columns
Unlike R, Python doesn't have a built-in data structure similar to data frames. The library pandas
gives you access to DataFrame
s in Python.
In pandas, you can either use the dot (.
) notation or the square bracket notation ([ ]
) to select columns. However, if your column name has a space in it, or if the name clashes with a DataFrame attribute, then the convenient dot notation won't work.
Cet exercice fait partie du cours
Python for R Users
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Print the tip column using dot notation
print(tips____)