Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pandas/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,20 @@

pd.Series([30, 35, 40], index=['2015 Sales', '2016 Sales', '2017 Sales'], name='Product A')

#We'll use the pd.read_csv() function to read the data into a DataFrame.
wine_reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv")

#We can use the shape attribute to check how large the resulting DataFrame is:
wine_reviews.shape

#Output
(129971, 14)

#We can examine the contents of the resultant DataFrame using the head() command, which grabs the first five rows:
wine_reviews.head()

#You can see in this dataset that the CSV file has a built-in index, which pandas did not pick up on automatically. To make pandas use that column for the index (instead of creating a new one from scratch), we can specify an index_col.
wine_reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0)