This repository which was created to facilitate working with csv
Project description
csv_file library
Author R.A.Vidonchikov
This library provides the ability to read a csv file, find the maximum and minimum elements in the matrix, plot the values of the matrix elements, and also transpose the matrix to another csv file.
def __init__(self, road, new_road):
self.road = road
self.results = []
self.line = 0
self.column = 0
self.new_road = new_road
def reader_csv_file(self):
"""Reads a CSV file and print it as a list of rows."""
with open(self.road, newline='', encoding='utf-8') as file:
inp = csv.reader(file, delimiter=';', quotechar=',', quoting=csv.QUOTE_NONE)
for row in inp:
self.line += 1
self.column = 0
for number in row:
self.column += 1
number = int(float(number))
self.results.append(number)
def finder_max(self):
maximum = np.amax(self.results)
return maximum
def finder_min(self):
minimum = np.amin(self.results)
return minimum
def graph(self):
x_list = list(range(0, len(self.results)))
y1_list = list(self.results)
fig, ax = plt.subplots(figsize=(10, 5))
ax.set_title('Демонстрация заполения матрицы')
ax.set_ylabel('Числа матрицы')
plt.plot(x_list, y1_list)
plt.ylabel("", fontsize=14, fontweight="bold")
plt.show()
def transpose(self):
matrix = np.asarray(self.results).reshape(-1, self.column)
matrix = matrix.transpose()
with open(self.new_road, "w", newline='') as f:
for row in matrix:
print(' '.join(map(repr, row)), file=f)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
csv_file-1.0.tar.gz
(2.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csv_file-1.0.tar.gz.
File metadata
- Download URL: csv_file-1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3374f843ab183efbd331b511d789882d6a0445f332aa08122e6c90ab34e1f381
|
|
| MD5 |
f62cd696d043b9dcda7dbf30d418d790
|
|
| BLAKE2b-256 |
960d0e4f3a9be3fceaef8bbeb29c8752b29f2497def1057285d6b6fea600a9ce
|
File details
Details for the file csv_file-1.0-py3-none-any.whl.
File metadata
- Download URL: csv_file-1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32ec2d882702cb5c88b63adb6b3e4e3ad948ea81dede839a1a242c718cebb7a0
|
|
| MD5 |
e3089badfd331c913976cf48b0f6f142
|
|
| BLAKE2b-256 |
3ed23a66b2f383ddbeeea354b5a4b0c5d6718e0fcdb6b401c7118c259ced4d08
|