CSV delimiters#
It is fairly common to encounter raw data files where the separator/delimiter is a character and not a comma.
Importing libraries and packages#
1# Mathematical operations and data manipulation
2import pandas as pd
Set paths#
1# Path to datasets directory
2data_path = "./datasets"
3# Path to assets directory (for saving results to)
4assets_path = "./assets"
Loading dataset#
1dataset_3 = pd.read_csv(f"{data_path}/example_3.csv")
2dataset_3
Column 1; Column 2; Column 3; Column 4 | |
---|---|
0 | 2; 1500; Good; 300000 |
1 | 3; 1300; Fair; 240000 |
2 | 3; 1900; Very good; 450000 |
3 | 3; 1850; Bad; 280000 |
4 | 2; 1640; Good; 310000 |
1dataset_3 = pd.read_csv(f"{data_path}/example_3.csv", sep=";")
2dataset_3
Column 1 | Column 2 | Column 3 | Column 4 | |
---|---|---|---|---|
0 | 2 | 1500 | Good | 300000 |
1 | 3 | 1300 | Fair | 240000 |
2 | 3 | 1900 | Very good | 450000 |
3 | 3 | 1850 | Bad | 280000 |
4 | 2 | 1640 | Good | 310000 |