小编Ale*_*tin的帖子

如何将 pandas <NA> 转换为 numy Nan?

我有以下数据集

在此输入图像描述

我想将 float 值转换为 int,所以我这样做了data.convert_dtypes()

在此输入图像描述

熊猫将 Nan 转换为 Na。我怎样才能让它回来或阻止熊猫这样做?我使用数据插补,有些算法不支持 ( 'bool' object has no attribute 'transpose')

我试过replacefillnaReplace({pd.NA: np.nan})将 int 再次转换为浮点数,这不是我的解决方案,因为我想使用 int

dataframe pandas

12
推荐指数
1
解决办法
8286
查看次数

单击后如何删除内联键盘?

我的机器人发送带有 2 个内联回调按钮的选择:喜欢/不喜欢。用户单击喜欢或不喜欢按钮后,我希望这个内联键盘消失。

这就是我制作不喜欢按钮的方法

 dislike_button =types.InlineKeyboardButton (text=emojize("Dislike :broken_heart:", use_aliases=True), callback_data='dislike')
    keyboard.add(dislike_button)
Run Code Online (Sandbox Code Playgroud)

这就是如何处理点击这个按钮

@bot.callback_query_handler(func=lambda call: True)
def query_handler(call):

   if call.data == 'dislike':
      bot.answer_callback_query(callback_query_id=call.id, text='you disliked it!')
Run Code Online (Sandbox Code Playgroud)

如何使该按钮在单击后消失?或者我怎样才能不再点击这个喜欢或不喜欢的按钮?

python telegram python-telegram-bot telegram-bot

11
推荐指数
2
解决办法
3万
查看次数

Django + Nginx + Uwsgi 查看Nginx默认页面然后运行在80端口

我有一个使用 Nginx + Uwsgi 在 VPS 上运行的 Django 应用程序。

Symlink nginx 配置

# the upstream component nginx needs to connect to
    upstream django {
        server unix:///root/ubergf/client/uwsgi_nginx.sock; # for a file socket
        # server 127.0.0.1:8001; # for a web port socket (we'll use this first)
    }

    # configuration of the server
    server {
        # the port your site will be served on
        listen      80;
        # the domain name it will serve for
        server_name my-site.com; # substitute your machine's IP address or …
Run Code Online (Sandbox Code Playgroud)

django nginx

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

PostgreSQL如何按主键按行分组?

我有以下查询

 SELECT "Nomenclature",
            CASE
                WHEN ad."Title" = '?????'
                    THEN au."Value"
                ELSE NULL END AS "?????",
            CASE
                WHEN ad."Title" = '??????????????'
                    THEN au."Value"
                ELSE NULL END AS "??????????????",
            CASE
                WHEN ad."Title" = '???????' THEN au."Value"
                ELSE NULL END AS "???????",
            CASE
                WHEN ad."Title" = '???????'
                    THEN au."Value"
                ELSE NULL END AS "??? ??????????"
     FROM "AttributeUnit" au
              JOIN "AttributeDictionary" ad ON au."AttributeDictionary" = ad."@AttributeDictionary"
     WHERE "Nomenclature" = ANY (ARRAY(SELECT "@Nomenclature" FROM base_info))
       AND ad."Title" IN ('?????', '??????????????', '???????', '??? ??????????')
Run Code Online (Sandbox Code Playgroud)

结果我有 3 …

sql postgresql

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

Heroku:编译的 Slug Size 太大 Python

我尝试将我的应用程序部署到heroku

\n

我有以下部署错误

\n
    transformers 4.8.2 requires huggingface-hub==0.0.12, but you'll have huggingface-hub 0.0.14 which is incompatible.\n       Successfully installed MarkupSafe-2.0.1 Send2Trash-1.7.1 altair-4.1.0 argon2-cffi-20.1.0 astor-0.8.1 async-generator-1.10 attrs-21.2.0 backcall-0.2.0 base58-2.1.0 beautifulsoup4-4.9.3 bleach-3.3.1 blinker-1.4 cachetools-4.2.2 certifi-2021.5.30 cffi-1.14.6 charset-normalizer-2.0.3 click-7.1.2 cloudscraper-1.2.58 debugpy-1.3.0 decorator-5.0.9 defusedxml-0.7.1 entrypoints-0.3 filelock-3.0.12 gitdb-4.0.7 gitpython-3.1.18 huggingface-hub-0.0.14 idna-3.2 ipykernel-6.0.3 ipython-7.25.0 ipython-genutils-0.2.0 ipywidgets-7.6.3 jedi-0.18.0 jinja2-3.0.1 joblib-1.0.1 jsonschema-3.2.0 jupyter-client-6.1.12 jupyter-core-4.7.1 jupyterlab-pygments-0.1.2 jupyterlab-widgets-1.0.0 matplotlib-inline-0.1.2 mistune-0.8.4 nbclient-0.5.3 nbconvert-6.1.0 nbformat-5.1.3 nest-asyncio-1.5.1 nltk-3.6.2 notebook-6.4.0 numpy-1.21.0 packaging-21.0 pandas-1.2.5 pandocfilters-1.4.3 parso-0.8.2 pexpect-4.8.0 pickleshare-0.7.5 pillow-8.3.1 prometheus-client-0.11.0 prompt-toolkit-3.0.19 protobuf-3.17.3 ptyprocess-0.7.0 pycparser-2.20 pydeck-0.6.2 pygments-2.9.0 …
Run Code Online (Sandbox Code Playgroud)

python heroku

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