I have the following table in a .csv file:
1,123 Sesame Street,Imaginary,XL,Seven Eleven #398,,
2,124 Sesame Street,Imaginary,XL,Seven Eleven #399,,
3,125 Sesame Street,Imaginary,XL,Seven Eleven #400,,
4,126 Sesame Street,Imaginary,XL,Seven Eleven #401,,
5,127 Sesame Street,Imaginary,XL,Seven Eleven #402,,
6,128 Sesame Street,Imaginary,XL,Seven Eleven #403,,
7,129 Sesame Street,Imaginary,XL,Seven Eleven #404,,
8,130 Sesame Street,Imaginary,XL,Seven Eleven #405,,
9,131 Sesame Street,Imaginary,XL,Seven Eleven #406,,
10,132 Sesame Street,Imaginary,XL,Seven Eleven #407,,
11,133 Sesame Street,Imaginary,XL,Seven Eleven #408,,
12,134 Sesame Street,Imaginary,XL,Seven Eleven #409,,
13,135 Sesame Street,Imaginary,XL,Seven Eleven #410,,
14,136 Sesame Street,Imaginary,XL,Seven Eleven #411,,
15,137 Sesame Street,Imaginary,XL,Seven Eleven #412,,
16,138 Sesame Street,Imaginary,XL,Seven Eleven #413,,
The table breaks down into the following columns:
DeviceNumber,DeviceStreetAddress,DeviceCity,DeviceState,DeviceStoredAt,DeviceConnect,Keys
I am attempting to search the table (which has several thousand entries) for a certain DeviceNumber or DeviceStreetAddress in their respective columns. The search should return the entire row containing the searched information to give me the additional information about the device that I am searching for. Preferably this would be returned in a list rather than a string.
I have found some bits and pieces of code that I have attempted, but I usually end up with an error like:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid >continuation byte or NameError: name 'column' is not defined etc.
I have the following code currently after doing a lot of banging my head against a wall and starting over and over again:
import pandas as pd
df = pd.read_csv('path/to/file.csv')
dev_id = df[0] #this should theoretically give me a list of the device ids
dev_address = df[1] #this should theoretically give me a list of addresses
TBH, I don't really even know what I'm technically trying to do anymore, or rather how to go about this. If someone can help me out a bit, I'd greatly appreciate it!