Last active
August 8, 2020 03:45
-
-
Save SolClover/9f3111e73824ca9cb053b4ed631a7d4f to your computer and use it in GitHub Desktop.
Read in CSV to Pandas DataFrame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import csv into a new Pandas DataFrame | |
new_df=pd.read_csv('C:/temp/test.csv') | |
# You can also specify which columns you want to read in with usecols by either | |
# specifying their name or position | |
# Using column names | |
new_df=pd.read_csv('C:/temp/test.csv', usecols=['Name','Surname', 'Height', 'Age']) | |
# Using column positions | |
new_df=pd.read_csv('C:/temp/test.csv', usecols=[0,1,2,3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment