Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on pandas module #432

Open
simonnchong opened this issue Jul 29, 2022 · 2 comments
Open

Error on pandas module #432

simonnchong opened this issue Jul 29, 2022 · 2 comments

Comments

@simonnchong
Copy link

I can print the result in the console without any error but AREPL reported many errors message.

Screenshot 2022-07-30 013846

@Almenon Almenon added the bug Something isn't working label Jul 30, 2022
@Almenon Almenon removed the bug Something isn't working label Jan 1, 2023
@Almenon
Copy link
Owner

Almenon commented Jan 1, 2023

Actually, I'm not able to reproduce this w/ Windows 10, python 3.10, and pandas 1.5.2. What version of pandas are you using?

import pandas as pd

data = pd.read_csv("C:\\dev\\misc\\candel\\weather_data.csv")


print(data[data["day"] == "Monday"])
#* or
print(data[data.day == "Monday"])

weather_data.csv:

day,temp,condition
Monday,12,Sunny
Tuesday,14,Rain
Wednesday,15,Rain

@heera-ai
Copy link

Hi @Almenon, I am facing issues while selecting multiple columns from a pandas DataFrame.

Python:
Python 3.9.16 (main, Jan 11 2023, 10:02:19)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin

Pandas:
Name: pandas
Version: 1.3.5
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: https://pandas.pydata.org
Author: The Pandas Development Team
Author-email: pandas-dev@python.org
License: BSD-3-Clause
Location: /Users/heera/miniforge3/envs/tensorflow/lib/python3.9/site-packages
Requires: numpy, python-dateutil, pytz
Required-by: pandas-datareader, seaborn

MacOS Ventura:
Version 13.2.1

import eventlet
eventlet.monkey_patch()

import warnings
warnings.filterwarnings("ignore")

import pandas as pd
df = pd.DataFrame(data = {
    "Name":["abc","pqr","xyz"],
    "Number":[5,10,15],
    "Location":["Delhi","Hyderabad","Pune"]})
df_name_loc = df[["Name","Number"]]
print(df_name_loc)

Error:

Traceback (most recent call last):
  line 12, in <module>
  File "/Users/heera/miniforge3/envs/tensorflow/lib/python3.9/site-packages/pandas/core/frame.py", line 3470, in __getitem__
    data = self._take_with_is_copy(indexer, axis=1)
  File "/Users/heera/miniforge3/envs/tensorflow/lib/python3.9/site-packages/pandas/core/generic.py", line 3628, in _take_with_is_copy
    result = self.take(indices=indices, axis=axis)
  File "/Users/heera/miniforge3/envs/tensorflow/lib/python3.9/site-packages/pandas/core/generic.py", line 3615, in take
    new_data = self._mgr.take(
  File "/Users/heera/miniforge3/envs/tensorflow/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 865, in take
    return self.reindex_indexer(
  File "/Users/heera/miniforge3/envs/tensorflow/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 676, in reindex_indexer
    new_blocks = self._slice_take_blocks_ax0(
  File "/Users/heera1/miniforge3/envs/tensorflow/lib/python3.9/site-packages/pandas/core/internals/managers.py", line 802, in _slice_take_blocks_ax0
    max_len = max(len(mgr_locs), taker.max() + 1)
  File "/Users/heera1/miniforge3/envs/tensorflow/lib/python3.9/site-packages/numpy/core/_methods.py", line 40, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
[TypeError: int() argument must be a string, a bytes-like object or a number, not '_NoValueType'](https://www.google.com/search?q=python%20TypeError:%20int()%20argument%20must%20be%20a%20string,%20a%20bytes-like%20object%20or%20a%20number,%20not%20%27_NoValueType%27)

Print Output:
Variables:
[-](vscode-webview://01h9evatblku50u4vv2dtjdc9le0pl9pkvtis1ljo8ih0btn16qo/index.html?id=61682136-9660-4219-9fee-9e82f676e143&origin=266bb1b2-da66-4490-bbdf-12e52fcb57b6&swVersion=4&extensionId=almenon.arepl&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app#){
    df: [-](vscode-webview://01h9evatblku50u4vv2dtjdc9le0pl9pkvtis1ljo8ih0btn16qo/index.html?id=61682136-9660-4219-9fee-9e82f676e143&origin=266bb1b2-da66-4490-bbdf-12e52fcb57b6&swVersion=4&extensionId=almenon.arepl&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app#){
        py/object: "pandas.core.frame.DataFrame",
        values: "Name,Number,Location\nabc,5,Delhi\npqr,10,Hyderabad\nxyz,15,Pune\n",
        txt: true,
        meta: [+](vscode-webview://01h9evatblku50u4vv2dtjdc9le0pl9pkvtis1ljo8ih0btn16qo/index.html?id=61682136-9660-4219-9fee-9e82f676e143&origin=266bb1b2-da66-4490-bbdf-12e52fcb57b6&swVersion=4&extensionId=almenon.arepl&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app#){[2 items](vscode-webview://01h9evatblku50u4vv2dtjdc9le0pl9pkvtis1ljo8ih0btn16qo/index.html?id=61682136-9660-4219-9fee-9e82f676e143&origin=266bb1b2-da66-4490-bbdf-12e52fcb57b6&swVersion=4&extensionId=almenon.arepl&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app#)}
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants