I am trying to work from csv files located inside of a django app. I am trying to load the file using pandas like: pd.read_csv("…") without success, I keep getting an error. Here is what the directory tree looks like: ├── __pycache__ │ ├── forms.cpython-36.pyc │ ├── models.cpython-36.pyc │ ├── views.cpython-36.pyc │ └── urls.cpython-36.pyc ├── ..
I have a bot that creates an Excel file from JSON data using the pandas module. But however, ServiceNow doesn’t read the file properly. If the file is saved after opening in Excel 2016, it then can be uploaded without any data change I checked the version of the file by opening it as a ..
I need to run a statistic on some data. See how many times a values "j" is next to a value "i". The code that I put hereafter is a gross simplification of what I need to to, but it contains the problem I have. Let’s say that you have this data frame. import numpy ..
I’m needing to read some CSV files, and am getting errors regarding columns of the file: extracted_file = pd.read_csv(filename) ParserError: Error tokenizing data. C error: Expected 2 fields in line 52, saw 3 Upon investigation of my files, I feel like it is the way they are formatted starting from line 52 where the error ..
Hello need some help with this problem a = pd.date_range(start="2001-01-01", freq="T", periods=520000) This creates the date-range i need for 1 year. I want to do the same for the next 80 years. The end result should be a date range for 80year but every year ends after 520000min. Then i add the date range to ..
I have data frame and there is multi columns and in each column there is https url link is there a way in python could extract the url from and row contins url ? Source: Python..
df: home_score away_score 1 0.0 1.0 2 2.0 1.0 3 3.0 2.0 4 0.0 0.0 5 1.0 1.0 Expected result: score — ——- 0 0:1 1 2:1 2 2:1 3 3:2 I am trying df[‘home_score’] = df[‘home_score’].astype(str).str.replace(‘^.*(.d)’, ”, regex=True) to strip the score before combining columns but I am not getting anything.. Also, this code ..
Let’s say my data looks like this: news_title company string Facebook string Facebook string Amazon string Apple string Amazon string Facebook How can I group the companies and get name and the number for the company with the biggest sum? I want be able to print something like : Facebook was mentioned in the news ..
I am having trouble applying filters with pandas. The problem looks like this. The first variable in the set (filter_names) should correspond to the first variable in the set (filter_values). The value of the second variable should be bigger or equal to the value given. In other words, in the input like this: df = ..
Let’s take this DataFrame: import itertools import numpy as np import pandas as pd tuples = list(itertools.product(list(‘abcd’), [1,2])) index = pd.MultiIndex.from_tuples(tuples, names=[‘letter’, ‘digit’]) data = np.random.rand(8, 4) df = pd.DataFrame(data, index=index, columns=list(‘abcd’)) I have the following function to get stacked bar plots and save them: def build_stacked_bar_graph(df: pd.DataFrame, xlabel: str, ylabel: str, title: str, saving_name: ..