Category "pandas"

How to cleanup BigQuery export to CSV using pandas

I exported my BigQuery data to CSV but can't figure out how to clean up the data as the headers are all appended on the backend in the same row. Here's my code:

Fill columns of one data frame with columns of other dataframe on group

I have one data frame with multiple columns as mentioned below. df1 a b c d e f dr1 a1 de1 dr2 a2 de2 dr3 a3 de3 dr4 a4

Code for finding accuracy in mask rcnn and plottingacuuracy annd loss graph

I want to evaluate the accuracy of my mask rcnn model more over i want to analyse my evaluation by seeing the accuracy and loss graph. So please help me to find

How to filter out data based on date in python of a csv file

I have a data set as of below & I want to filter data from 2021-07-30 to 2021-08-03 Below is the dataset input.csv created_at,text,label 2021-07-24,Newzelan

4 I am trying to put array into a pandas dataframe

import pandas as pd import numpy as np zeros=np.zeros((6,6)) arra=np.array([zeros]) rownames=['A','B','C','D','E','F'] colnames=[['one','tow','three','four','f

How to fill in row value based on previous and subsequent rows in pandas

I have the following data. There are consecutive runs of True per day, however sometimes there's the odd False for a day followed by True. Due to the nature of

Preparing input data for LSTM layer with conditions

I have a data frame that looks like the one below: DF.head(20): time var1 var2 prob 12:30 10 12 85 12:31 15

how to do check column values is not clash if all value correspond to same value of other column, if clashed then return that row

s_id PSC pbx 4 pbx 5 pbx 7 pby 8 pbn 8 pby 7 pbn 8 now check PSC of pbx does not clash bt PSC of pbn clashed

Mapping team changes over time in Python

I have the following dataframe in Python that lists team lineage for a Formula 1 team in that it identifies when teams change name and what they change to: impo

Having an issue plotting: Columns must be same length as key

I'm new to Python and I'm trying to adjust this code to my data: import random import pandas as pd import numpy as np import matplotlib.pyplot as plt import mat

Pandas groupby mean - into a dataframe?

Say my data looks like this: date,name,id,dept,sale1,sale2,sale3,total_sale 1/1/17,John,50,Sales,50.0,60.0,70.0,180.0 1/1/17,Mike,21,Engg,43.0,55.0,2.0,100.0 1

How to convert YYYYMM to YYYY-MM datetime format without day?

I have two datasets that have monthly frequencies. For one of them,df, I had to aggregate some data to turn it from daily to monthly using the following code: d

differenc between using panda.drop_duplicate or value_count on whole frame or one column

I am a new python user just for finish the homework. But I am willing to dig deeper when I meet questions. Ok the problem is from professor's sample code for d

How to calculate the session change of daily bars

I have a DF that looks like: date volume open close high low previous close 2022-05-02 1756159.0 118.38 119.57 120.34 116.49 2022-05-03 3217838.0 119.72 122.4

How to solve error with limits in boxplot (seaborn)?

The code used to plot the box plot: import seaborn as sns ax= sns.boxplot(x = "Current_Sim_Az_obj1",y= "RUT_Distance",data = df2,whis = (0,100),meanline= True,s

Refreshing data from csv in python using pandas

I'm new to python and trying to learn it on the go, i'm tring to make a data entry phonebook using python with pandas. There is the code I wrote: import pandas

Make a list from a data frame that has repeated and non repeat values in columns

I have a data frame like this data = [['Ma', 1,'too'], ['Ma', 1,'taa'], ['Ma', 1,'tuu',],['Ga', 2,'too'], ['Ga', 2,'taa'], ['Ga', 2,'tuu',]] df = pd.DataFra

How to replace a list inside a multildimensional array?

I was solving this question on SO and faced a few problems with the methods I was trying. OP has a list which looks like this, a = [[[100, 90, 80, 255],

Hey guys i was trying read csv file using pandas in pycharm i am getting this error how to resolve it ,i was able to run in googlecolab but in pycharm [duplicate]

#i am getting url error how do i resolve it C:\Python\python.exe E:/data_science/Python_basic/module1_eda/EDA.py Traceback (most recent

pandas datetime to unix timestamp seconds

From the official documentation of pandas.to_datetime we can say, unit : string, default ‘ns’ unit of the arg (D,s,ms,us,ns) denote the unit,