提交 a18d1be5 编写于 作者: D Doug Farrell

Modified code based on CircleCI failures

上级 81ed09a9
......@@ -34,7 +34,9 @@ def populate_database(session, author_book_publisher_data):
.one_or_none()
)
if author is None:
author = Author(first_name=row["first_name"], last_name=row["last_name"])
author = Author(
first_name=row["first_name"], last_name=row["last_name"]
)
session.add(author)
book = (
......
"""
This is the example 1 program file
This example program was kindly created by Geir Arne Hjelle, another RealPython author,
as part of the editorial process to improve this article and the information it presents.
You can learn more about Geir from this URL: https://realpython.com/team/gahjelle/
This example program was kindly created by Geir Arne Hjelle,
another RealPython author, as part of the editorial process
to improve this article and the information it presents.
You can learn more about Geir from this URL:
https://realpython.com/team/gahjelle/
"""
from importlib import resources
from typing import List
import pandas as pd
from treelib import Tree
......@@ -25,15 +26,14 @@ def get_books_by_publisher(
a Pandas series
Args:
data (pd.DataFrame): The Pandas dataframe to get the data from
ascending (bool, optional): The sorting direction for the returned data. Defaults to True.
data (pd.DataFrame): The Pandas dataframe to get the
data from ascending (bool, optional): The sorting
direction for the returned data. Defaults to True.
Returns:
pd.Series: The sorted data as a Pandas series
"""
return data.groupby("publisher") \
.size() \
.sort_values(ascending=ascending)
return data.groupby("publisher").size().sort_values(ascending=ascending)
def get_authors_by_publisher(
......@@ -43,8 +43,9 @@ def get_authors_by_publisher(
a Panda series
Args:
data (pd.DataFrame): The Pandas dataframe to get the data from
ascending (bool, optional): The sorting direction for the returned data. Defaults to True.
data (pd.DataFrame): The Pandas dataframe to get the data
from ascending (bool, optional): The sorting direction for
the returned data. Defaults to True.
Returns:
pd.Series: The sorted data as a Pandas series
......@@ -92,7 +93,7 @@ def add_new_book(
def output_author_hierarchy(data: pd.DataFrame):
"""This function outputs the data as a hierarchy with
"""This function outputs the data as a hierarchy with
the authors as the root node
"""
authors = data.assign(
......
......@@ -5,7 +5,6 @@ This program gathers information from the temp_data.csv file about temperature
from typing import List
from uuid import uuid4
from flask_sqlalchemy import SQLAlchemy
from pkg_resources import resource_filename
from sqlalchemy import and_, create_engine
from sqlalchemy.orm import sessionmaker
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册