import pandas as pd # importing library pandas
Sales = pd.read_csv("datasets\\Superstore Sales Data\\Sales_sample.csv")
print(Sales)
import pandas as pd
wb_data = pd.read_excel("datasets\\World Bank Data\\World Bank Indicators.xlsx" , "Data by country",index_col=None, na_values=['NA'])
wb_data.head(5)
Data: Superstore Sales Data\Sales_sample.csv
Code | Description |
---|---|
Sales.shape | To check the number of rows and columns |
Sales.columns.values | What are the column names?, Sometimes import doesn’t consider column names while importing |
Sales.head(10) | First few observations of data |
Sales.tail(10) | Last few observations of the data |
Sales.dtypes | Data types of all variables |
Code | Description |
---|---|
Sales.describe() | Summary of all variables |
Sales[‘custId’].describe() | Summary of a variable |
Sales.salesChannel.value_counts() | Get frequency table for a given variable |
table(Sales$custCountry) | Get frequency tables for categorical variables |
sum(Sales.custId.isnull()) | Missing value count in a variable |
Sales.sample(n=10) | Take a random sample of size 10 |
The next post is a practice session with datasets on Python.
Link to the next post :https://statinfer.com/104-2-1-importing-data-in-python/