小编Ija*_*him的帖子

Next.js getServerSideProps(抛出错误)结果为 404 而不是 500

我有非常基本的设置,即 getServerSideProps 和Vercel生产中的 Sentry 错误日志记录

export const getServerSideProps = async () => {
  // some api call
 if(error) {
  throw new Error("Something went wrong")
}
  return {
    props: {
       data
    }
  };
};
Run Code Online (Sandbox Code Playgroud)

_error.js看起来像这样

import * as Sentry from '@sentry/nextjs'
import { NextPageContext } from 'next'
import NextErrorComponent, { ErrorProps as NextErrorProps } from 'next/error'

const CustomErrorComponent = (props: NextErrorProps) => {
  return <NextErrorComponent statusCode={props.statusCode} />
}

CustomErrorComponent.getInitialProps = async (contextData: NextPageContext) => {
  await Sentry.captureUnderscoreErrorException(contextData)

  
  console.log(contextData.res?.statusCode) // …
Run Code Online (Sandbox Code Playgroud)

server-side-rendering next.js vercel

9
推荐指数
1
解决办法
1078
查看次数

Python - 按月和日绘制多个数据帧(忽略年份)

我有多个具有不同年份数据的数据框。

数据框中的数据是:

>>> its[0].head(5)
            Crocs
date             
2017-01-01     46
2017-01-08     45
2017-01-15     43
2017-01-22     43
2017-01-29     41

>>> its[1].head(5)
            Crocs
date             
2018-01-07     23
2018-01-14     21
2018-01-21     23
2018-01-28     21
2018-02-04     25

>>> its[2].head(5)
            Crocs
date             
2019-01-06     90
2019-01-13     79
2019-01-20     82
2019-01-27     82
2019-02-03     81
Run Code Online (Sandbox Code Playgroud)

我尝试将所有这些数据帧绘制在单个图形(图表)中,是的,我完成了,但这不是我想要的。

我使用以下代码绘制了数据框

>>> for p in its:
    plt.plot(p.index,p.values)
>>> plt.show()
Run Code Online (Sandbox Code Playgroud)

我得到了下图 结合所有dfs得到的图

但这不是我想要的我希望图表是这样的 我想要的图

只是我希望图表忽略年份并按月和日绘制

plot matplotlib dataframe python-3.x pandas

5
推荐指数
1
解决办法
2419
查看次数