Most voted "pandas" questions
Pandas is an open source library, which provides high performance data structures and data analysis tools for the Python programming language.
Learn more…646 questions
Sort by count of
-
0
votes1
answer365
viewsExtract specific information from an excel cell using pandas in Python
I need to extract information from a cell in excel using pandas and pyautogui. The cell has a date contained and accurate take out the numbers without the "/" bars. Example: 25/12/2000. What I do at…
-
0
votes1
answer95
viewsRemove Row and Column Indexes in the Dataframe
I’m learning python and I started using pyqt5 as a graphical interface and, to force learning, I’m doing a little contest ball drawing. For data analysis I’m using DataFrame and adding to…
-
0
votes2
answers68
viewsJoin cells with python
I am making a web scraping to take data from the best actions of the day and join in a table in an excel file. I am trying by code: from selenium import webdriver from webdriver_manager.microsoft…
-
0
votes1
answer57
viewsDoubt For i Range Python
First, I have 2 dataframe with several latitude and longitude points: db_gas2['lat-long'] = db_gas2['latitude'].astype(str)+', '+db_gas2['longitude'] db_gas2 db_cidades3['lat-long'] =…
-
0
votes0
answers49
viewsDelete lines from a Dataframe from a list of python strings
I am with A Dataframe for analysis of Covid-19 and When I pull the largest amount of cases or deaths, return me to the continents and I would like to delete only the entries where the continents…
-
0
votes1
answer40
viewsHow to turn every two records of a Datframe into a single in Python based on two columns
Expensive, I have a Dataframe in which every two lines refer to a single record. I need to make a union of these lines based on the "id" and the "boss" to turn into one. The "principal" column has…
-
0
votes2
answers41
viewsCompare lines Dataframa Pandas
import pandas as pd from IPython.core.display import display df = pd.read_csv('plan.csv', sep=';') ## le a planilha display(df) df = df.sort_values('cpf') ## organiza a planilha de ordem de cpf…
pandasasked 3 years, 6 months ago Gabriel Schumacher 3 -
0
votes1
answer31
viewsDifficulty Merging Sequential Columns in a Dataframe with Pandas
I have two dates frames, the two have exactly the same index, the difference is that one has the columns 'week 9' until 'week 30', and the other has the columns 'week 31' until 'week 53'. Until now…
-
0
votes1
answer33
viewsGroup By without merging python data labels
Hello, people, I have the dataframe below and I need to group and add the columns. For this I am using groupby, but in the result the labels are cancatenated, there is a way that this does not…
-
0
votes1
answer88
viewsCount dataframe lines with string according to position in Python text
I have a dataframe with a text column, as follows: import pandas as pd df = pd.DataFrame([["1", "texto com PALAVRA frAse PARAGRAFO", True, "foo"], ["2", "texto com palavra Paragrafo", False, "foo"],…
-
0
votes1
answer61
viewsAdd values from a column that are duplicated using groupby as python criteria
I have a data frame that needs to be removed duplicates and later from the previous dataframe I need to add a specific column. Actually I have 5 DF, 4 have already worked, but one because it…
-
0
votes1
answer22
viewsIF no pandas returning The Truth value of a Series is ambiguous. Use a.Empty, a.bool(), a.item(), a.any() or a.all()
I have a DS with two columns, one with a month from 1 to 12, and another with a year from 2015 to 2021, and I’m trying to create a column called Fiscal Year. I am creating a function so that when…
-
0
votes0
answers16
viewsHow to format output numbers using Pandas package?
I’m new to Python. Using "formatters" and Pandas package, how to format the output of a decimal number to the Brazilian standard ? I did that and it worked, but if there’s any simpler way...…
pandasasked 3 years, 4 months ago Robson de Melo 11 -
0
votes1
answer37
viewsI would like to know faster ways to execute the insertion of information in one column based on the value of another
I have a Dataframe with numerous columns, but for the following question the important columns are: ID (number) of the report Product Event Example: id_relato event product 456 edema medication1 456…
-
0
votes2
answers46
viewsI have a date/time start and end frame, how do I separate for dates / start time / end time on pandas?
In the database I have a report containing: INICIO FINAL 20/07/2021 09:17 20/07/2021 09:25 20/07/2021 09:17 20/07/2021 09:25 20/07/2021 09:17 20/07/2021 09:25 20/07/2021 09:28 20/07/2021 09:33 I…
-
0
votes1
answer23
viewsPandas - Problems with ". Loc[]" in multiple inputs
My project has 4 user-given inputs that are stored in variables a, b, c, d. I use these entries to filter information from a giant . csv by storing it in a dataframe. The filter is made using…
-
0
votes1
answer29
viewsPandas group into groups with a determining range
beauty? I’m trying to group values of a dataframe called df_agenda by age, wanted to group the values in this way in the age: of (0-20),(20-40), (40-60) and so up to the maximum value of the list of…
-
0
votes0
answers45
viewsExtract values from specific parts of a . txt PYTHON
I have a Test Base that I need to extract some values in a standard way, but several times I receive more than one value between the beginning and the last line that starts with 0089 (CONVENIO) in…
-
0
votes1
answer30
viewsHow to unify dates with Python dataframe
Good afternoon guys, I have the following situation. I have a spreadsheet with the following columns: name, surname, dates(from 2011 until 2021) Follow the table to view: As you can see, these dates…
-
0
votes1
answer16
viewsPython Pandas - Insert list items in order in a column
That’s the kind of doubt that gets hard to even explain, but let’s try. Follows the code: data = {"Id": ["01", "02", "03", "04",'05'],"Fruta":…
-
-1
votes1
answer4942
viewsPython/Pandas - How to create a "str" column from another numeric, including zero on the left when the value is less than 9
The code I used to create the column is returning with the following error: The Truth value of a Series is ambiguous. Use a.Empty, a.bool(), a. item(), a.any() or a.all(). I don’t know how to fix…
-
-1
votes1
answer289
viewsConsultation in public database
I need to perform queries in an online database, and turn the returned data into a data frame. I used an existing example on the database website, but I have no idea how to turn it into a database.…
-
-1
votes3
answers773
viewsPandas does not find file
I am using pandas in Python to read a CSV file that is on my computer, however appears an error message, it seems that it does not find the file: import pandas as pd reclamacoes =…
-
-1
votes1
answer41
viewsSelect lines by first digits, and average them per year
I have a CSV of the following type: code year sales 2011 1970 5000 2011 1971 5200 2011 1972 ... ... 2015 1970 2015 1971 2015 1972 ... 3025 ... 3026 ... 3052 ... How can I select all lines from code…
-
-1
votes1
answer21
viewsMAP function applied to only one column
I’m trying to map the value "Others" to a "Career" column, according to some criteria. For example, when the column contains the Recycle Bin or Helper value, I want that value replaced by the Other…
-
-1
votes2
answers587
viewsConvert number to hours in python
How to convert a 1234 number representing houras to a string with time format e.g. 12:34 in python?
-
-1
votes1
answer29
viewsHow to add multiple column content
Based on csv year columns, Month, day, hour, minute how to add to a single column? df['date'] = pd.to_datetime(
-
-1
votes1
answer349
viewsHow to change the month of a datetime object in pandas?
good afternoon, I have a column of the pandas dataset for the month of September whose . head() is: [in] :df_setembro.head() [out]: 0 01/08/2018 1 02/08/2018 2 03/08/2018 3 04/08/2018 4 05/08/2018…
-
-1
votes1
answer151
viewsUncompromising a CSV file import using Pycharm
Good night, I want to import an excel file, and then I can manipulate it, but when I import the spreadsheet into Pycharm the file is all disfigured. Can someone help me? The following text is…
-
-1
votes1
answer42
viewsMathematical operation with CSV files
Hello! imported a. csv file with some columns and I would like to do calculations with this data, but I don’t know how to do this. Example as it would be in excel:…
-
-1
votes1
answer395
viewsPYTHON DELIMITER
How do I read a file containing data separated by period and comma appear in the table in Pyhton? Initially I have two txt files, I am using the pandas library I need to generate a txt third and put…
-
-1
votes1
answer379
viewsI want to convert Timedelta to float
I have a Dataframe in which one of the columns is the time interval in days between the search from one row to another, the data of this column are in the Timedelta form, as in the example:…
-
-1
votes1
answer2035
viewsHow to find data based on another column with Pandas?
I own the dataframe dfa: id nome 1 jose 2 pedro 3 maria 3 maria 2 pedro 1 jose And a list with ids: ids = [2, 3] I want a dataframe dfb be the values of dfa filtered on the basis of ids: id nome 2…
-
-1
votes1
answer56
viewsError Convert data format EN
Trying to convert str to date in BR format but from the error below. And if I take 'format' it goes in American format: df = pd.read_csv(‘df.csv',encoding='cp1252', sep=';') df['Data']=…
-
-1
votes1
answer103
views(Pandas) to_scv error in parameter Sep=
I am trying to play the content of a dataset on an scv, however the parameter SEP =';' stopped working. df.to_csv(path,r'\20191122_Consolidados_camara_de_retencao.csv', sep = ';') When trying to run…
-
-1
votes1
answer253
viewsHow to order a dataset
I’m trying to sort the numerical values of a dataset in ascending order using : df.sort_values(by=['radius_mean'], axis=0) But I would like to sort all the columns in ascending order and not sort…
-
-1
votes1
answer56
viewsPython pandas import
I have this import and then set the columns I want. I can in the import itself set the columns I want? import pandas as pd…
-
-1
votes1
answer421
viewsProblem in performing a Groupby of a Dataframe - Pandas
I’m trying to accomplish a groupy in a Dataframe that consists of cases of covid-19 per state in Brazil. However when I pass the function it returns me the following error in the figure below. There…
-
-1
votes1
answer158
viewsHow can I view an Axessubplot object in the same way as pyplot.show()?
I’m learning how to deal with pandas and after getting a Dataframe, the next step was to get a chart of this Dataframe "Upermarket": supermarket.loc[:10, 'Total'].plot(figsize=(14, 6)) This results…
-
-1
votes1
answer46
viewsStack data from a list in pandas
I’m trying to stack several csv files that are listed in a csv file type, but when I apply iteration on them I just preview the last file. Follows the code. import pandas as pd import numpy as np…
pandasasked 4 years, 7 months ago Gugamderosa 1 -
-1
votes2
answers188
viewsReplace specific strings in the dataframe with empty values
I have a file. csv I’m treating, and the column ap_residencia_status should only be populated with floats but is filled with strings (even numeric values are strings) and the values that should be…
-
-1
votes1
answer102
viewsChanging the axes of a data histogram to improve data visualization
I am practicing a bit of data science for a college project with the information available on COVID19 and from there I am trying to estimate by graphs the distribution of age groups but when I was…
-
-1
votes2
answers409
viewsSave Date and Time File in Python Name
Friends, I’m new in python and I’m trying to save a file that contains the date and time as the file name. That’s my code, but it’s not working. Where am I going wrong? from datetime import date,…
-
-1
votes1
answer381
viewsHow to convert Object to number in pandas?
import pandas as pd arq = pd.read_csv("arquivo.csv", sep=";") I want to use values in the Valor but is in object. But when I use the code arq["Valor"] = arq["Valor"].astype(int) error appears:…
-
-1
votes2
answers1401
viewsInstallation libraries jupyter notebook
I’m trying to import the pandas in the notebook jupyter plus it gives me the following mistake: import pandas as pd ---------------------------------------------------------------------------…
-
-1
votes2
answers284
viewsConvert pandas dataframe column with string array (Python)
I have a data frame pandas in Python, in which one of the columns is bringing the values in an array(list). I would like to remove the brackets ([]), to convert into string. I have tried with strip,…
-
-1
votes1
answer67
viewsreplace in numpy array
I have a phrase dataset and how do I use a replace in the numpy array EX x = array(['mais uma vez, o Sr. Costner arrumou um filme por muito mais tempo do que o necessário desse filme.])…
-
-1
votes1
answer39
viewslist with values greater than those reported by the user
I need a program that prints a list with values greater than the one informed by the user, and these values that need to be printed by the list are in a function already defined. My code: import…
-
-1
votes1
answer116
viewsSelect python - Pandas
I am developing a python program where I import two xlsx files directly with the Pandas library, I can import them easily, but I need to create a report between these two files. How can I do?…
-
-1
votes2
answers212
viewsCreate date variable
I’m starting with Python, I’ve been working with Qlikview for many years and I’m migrating some data processing activities to Python. I would like to create a set with a variable of days and months.…