Эксель группировка
This commit is contained in:
1 parent
506e657cbe
commit
68e5729c4f
3 files changed
+32
-3
No files matched your search
BIN
Binary file not shown.
@@ -1,3 +1,4 @@
|
|||||||
|
from openpyxl import load_workbook
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
import datetime
|
import datetime
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
@@ -5,6 +6,7 @@ from .models import *
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from userauth.models import *
|
from userauth.models import *
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
class GeneralVacationAPIView(APIView):
|
class GeneralVacationAPIView(APIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
@@ -25,9 +27,36 @@ class GeneralVacationAPIView(APIView):
|
|||||||
|
|
||||||
class DailyRoundUpAPIView(APIView):
|
class DailyRoundUpAPIView(APIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
user = DictEmployee.objects.using('user_directory').values('login', 'fio')
|
user = DictEmployee.objects.using('user_directory').values('login', 'department', 'familyname', 'name', 'parentname')
|
||||||
df = pd.DataFrame.from_records(user)
|
df = pd.DataFrame.from_records(user)
|
||||||
print(df)
|
df['tabel'] = df['login'].str.split('-', expand = True)[1]+df['login'].str.split('-', expand = True)[2]
|
||||||
|
for i in df['department'].unique():
|
||||||
|
k = df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']]
|
||||||
|
# (df['department']==i)
|
||||||
|
print(k)
|
||||||
|
return Response('')
|
||||||
|
#
|
||||||
|
# file_path = 'media/DailyRoundUp.xlsx'
|
||||||
|
# df.to_excel(table)
|
||||||
|
|
||||||
|
|
||||||
return Response('user')
|
# def all_books(request):
|
||||||
|
# file_path = 'media/DailyRoundUp.xlsx'
|
||||||
|
# workbook = load_workbook(filename=file_path)
|
||||||
|
# worksheet = workbook.active
|
||||||
|
|
||||||
|
# books = []
|
||||||
|
# skip_first_row = True
|
||||||
|
# for row in worksheet.iter_rows(values_only=True, min_row=2 if skip_first_row else 1):
|
||||||
|
# book = {
|
||||||
|
# 'book_id': int(row[0]),
|
||||||
|
# 'title': row[1],
|
||||||
|
# 'author': row[2],
|
||||||
|
# 'genre': row[3],
|
||||||
|
# 'year': int(row[4]),
|
||||||
|
# 'description': row[5],
|
||||||
|
# 'cover': row[6]
|
||||||
|
# }
|
||||||
|
# books.append(book)
|
||||||
|
|
||||||
|
# return render(request, 'books.html', {'books': books})
|
||||||
Binary file not shown.
Reference in new issue
Block a user