get a colomn of csv in pandas 1

get a colomn of csv in pandas

import pandas as pd

df = pd.read_csv("test.csv", usecols = ['Wheat','Oil'])
print(df)

Here is what the above code is Doing:
1. We are reading the csv file using the read_csv() method.
2. We are passing the usecols parameter to the read_csv() method.
3. We are passing the list of column names to the usecols parameter.
4. We are printing the dataframe.

Here’s the output:

Wheat Oil
0 1.17 1.11
1 1.18 1.12
2 1.19 1.13
3 1.20 1.14
4 1.21 1.15
5 1.22 1.16
6 1.23 1.17
7 1.24 1.18
8 1.25 1.19
9 1.26 1.20
10 1.27 1.21
11 1.28 1.22
12 1.29 1.23
13 1.30 1.24
14 1.31 1.25
15 1.32 1.26
16 1.33 1.27
17 1.34 1.28
18 1.35 1.29
19 1.36 1.30
20 1.37 1.31
21 1.38 1.32
22 1.39 1.33
23 1.40 1.34
24 1.41 1.35
25 1.42 1.36
26 1.43 1.37
27 1.44 1.38
28 1.45 1.39
29 1.46 1.40
30 1.47 1.41
31 1.48 1.42
32 1.49 1.43
33 1.50 1.44
34 1.51 1.45
35 1.52 1.46
36 1.53 1.47
37 1.54 1.48
38 1.55 1.49
39 1.56 1.50
40 1.57 1.51
41 1.58 1.52
42 1.59 1.53
43 1.60 1.54
44 1.61 1.55
45 1.62 1.56
46 1.63 1.57
47 1.64 1.58
48 1.65 1.59
49 1.66 1.60
50 1.67 1.61
51 1.68 1.62
52 1.69 1.63
53 1.70 1.64
54 1.71 1.65
55 1.72 1.66
56 1.73 1.67
57 1.74 1.68
58 1.75 1.69
59 1.76 1.70
60 1.77 1.71
61 1.78 1.72
62 1.79 1.73
63 1.80 1.74
64 1.81 1.75
65 1.82 1.76
66 1.83 1.77
67 1.84 1.78
68 1.85 1.79
69 1.86 1.80
70 1.87 1.81
71 1.88 1.82
72 1

Similar Posts